- new ConnectActionServer(s) {
- @Override
- public void action(Version clientVersion) throws Exception {
- try {
- for (Object data = rec(); true; data = rec()) {
- Object rep = null;
- try {
- rep = onRequest(this, clientVersion, data);
- } catch (Exception e) {
- onError(e);
- }
- send(rep);
- }
- } catch (NullPointerException e) {
- // Client has no data any more, we quit
- tracer.trace(name
- + ": client has data no more, stopping connection");
- }
- }
-
- @Override
- public void connect() {
- try {
- super.connect();
- } finally {
- count(-1);
- }
- }
- }.connectAsync();