Hi,
I've encountered two small problems. Both problems came out in java implementation of Ice. The first one appeared when I've written unit test for the server I began to implement. I wrote sequence of unit tests, which every one was builed like this:
--========= Initialization part
server initialization
client initialization
test some functionality
--========= Release part
client deinitialization
server deinitialization
For both - server and client I used shutdown and destroy methods. For server I used also deactivate adapter created by me. First unit test passed without any problems, problems appeared when began second unit test. The initialization of the server failed, because of the socket was still binded to the interface. The problem encountered on the windows XP platform, I used JDK 5.0. Below I put the stack trace, printed by the second unit test
[ Network: attempting to bind to tcp socket 127.0.0.1:5555 ]
Ice.SyscallException
error = 0
at IceInternal.IncomingConnectionFactory.<init>(Incom ingConnectionFactory.java:460)
at Ice.ObjectAdapterI.<init>(ObjectAdapterI.java:829)
at IceInternal.ObjectAdapterFactory.createObjectAdapt er(ObjectAdapterFactory.java:130)
at Ice.CommunicatorI.createObjectAdapterWithEndpoints (CommunicatorI.java:53)
at Ice.CommunicatorI.createObjectAdapter(Communicator I.java:47)
at dist.dj.server.RequestListener.run(RequestListener .java:37)
at dist.dj.util.pool.ThreadPool$PooledThread.run(Thre adPool.java:63)
Caused by: Ice.SocketException
error = 0
at IceInternal.Network.doBind(Network.java:211)
at IceInternal.TcpAcceptor.<init>(TcpAcceptor.java:12 8)
at IceInternal.TcpEndpointI.acceptor(TcpEndpointI.jav a:369)
at IceInternal.IncomingConnectionFactory.<init>(Incom ingConnectionFactory.java:409)
... 6 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSock etChannelImpl.java:119)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAd aptor.java:59)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAd aptor.java:52)
at IceInternal.Network.doBind(Network.java:205)
... 9 more
The second problem is the content of an exception class generated by the slice2java tool. It's small but annoying :] It generates warning in the Eclipse IDE. Below I put an example of part of method.
public class ClientNotLogged extends Ice.UserException
{
[...]
public void
__read(IceInternal.BasicStream __is, boolean __rid)
{
if(__rid)
{
String myId = __is.readString(); <-- I suppose, that is for skipping part of the data packet
}
__is.startReadSlice();
message = __is.readString();
__is.endReadSlice();
}
[...]
}

Reply With Quote