Hi:
When I study ICE, found some errors. anybody can help me?thanks.
I implemented a server in C#,implemented a client in java.
In client, there is a thread named 'StationWatcher' execute the run method every 10 seconds:
@Override
public void run() {
ArrayList<Station> temp = new ArrayList<Station>();
for (Station s : Config.getAllStation()) {
int[] errCircuits = isNormal(s);
if (errCircuits.length > 0) {
temp.add(s);
}
}
}
private int[] isNormal(Station s) {
IntBuffer temp = IntBuffer.allocate(s.getAllCircuit().size());
for (Circuit c : s.getAllCircuit()) {
if (c.isHasStealProof()) {
String sProof = DBCommProxy.getInstance().getValue(
c.getVariable(VariableTemplete.StealProo f));
if (sProof != null) {
if (!sProof.equals("1")) {
temp.put(c.getID());
}
}
}
}
temp.flip();
int[] rtn = new int[temp.limit()];
temp.get(rtn);
return rtn;
}
The DBCommProxy is a class extends from Ice.ObjectPrx. when DBCommProxy.getInstance().getValue catch any exception , it will stop the thread StationWatcher.
when the server is closed, client console will throw the follow exception continuously 。buy when the server is closed, the exception will raise in DBCommProxy.getInstance().getValue, and the StationWatcher thread will be stoped. but why It seems that the ice client is try to connect the server again and again.
!! 10-7-23 22:04:35:522 error: Ice.ThreadPool.Client-0: exception in `Ice.Thread
Pool.Client':
Ice.SocketException
error = 0
at IceInternal.ThreadPoolWorkQueue.postMessage(Thread PoolWorkQueue.java:
166)
at IceInternal.ThreadPoolWorkQueue.message(ThreadPool WorkQueue.java:114)
at IceInternal.ThreadPool.run(ThreadPool.java:302)
at IceInternal.ThreadPool.access$300(ThreadPool.java: 12)
at IceInternal.ThreadPool$EventHandlerThread.run(Thre adPool.java:643)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(Socke tChannelImpl.java:1
26)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelIm pl.java:324)
at sun.nio.ch.SinkChannelImpl.write(SinkChannelImpl.j ava:96)
at IceInternal.ThreadPoolWorkQueue.postMessage(Thread PoolWorkQueue.java:
162)
... 5 more
event handler: work queue
!! 10-7-23 22:04:35:537 error: Ice.ThreadPool.Client-0: exception in `Ice.Thread
Pool.Client':
Ice.SocketException
error = 0
at IceInternal.ThreadPoolWorkQueue.postMessage(Thread PoolWorkQueue.java:
166)
at IceInternal.ThreadPoolWorkQueue.message(ThreadPool WorkQueue.java:114)
at IceInternal.ThreadPool.run(ThreadPool.java:302)
at IceInternal.ThreadPool.access$300(ThreadPool.java: 12)
at IceInternal.ThreadPool$EventHandlerThread.run(Thre adPool.java:643)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(Socke tChannelImpl.java:1
26)
is there some wrong in client JAVA code ?

Reply With Quote
