Server is already started!");
}
} void stop () {(isStarted) {future=mainChannel.close ();. awaitUninterruptibly ();. shutdown ();=false; (isLogged) {. log (Level.INFO, «Server was manually stopped.»);
}. out.println («Server stopped.»);
} else {. out.println («Server is not started!");
}
} ServerLogger getLogger () {logger;
} void setLogger (ServerLogger logger) {(logger == null) {new NullPointerException («Logger can not be null!");
}. logger=logger;=true;
} void setFilter (ConnectionFilter filter) throws Exception {. getPipeline (). addFirst («Filter», filter);
}
}com.gmail.dosofredriver.ajax.serviceserver.server.session;org.jbossty.channel.Channel;java.nio.ByteBuffer;
/ **
* Date: 02.03.13
* Time: 19:13
*
* @ author DoSOfRR
* / class Session {ByteBuffer data; Channel channel; Session (ByteBuffer data, Channel channel) {. setChannel (channel);. setData (data);
} ByteBuffer getData () {data;
} void setData (ByteBuffer data) {. data=data;
} Channel getChannel () {channel;
} void setChannel (Channel channel) {. channel=channel;
}
}com.gmail.dosofredriver.ajax.serviceserver.server.session;org.jbossty.channel.ChannelFuture;org.jbossty.channel.ChannelFutureListener;org.jbossty.channel.Channels;java.util.concurrent.BlockingQueue;java.util.concurrent.LinkedBlockingQueue;
/ **
* Date: 27.02.13
* Time: 14:42
*
* @ author DoSOfRR
* / class SessionController {BlockingQueue store; static SessionController ourInstance=new SessionController (); static SessionController getInstance () {ourInstance;
} SessionController () {= new LinkedBlockingQueue <> ();
} void putSession (Session session) throws InterruptedException {. put (session);
} void response (Session session) {future=Channels.write (session.getChannel (), session);. addListener (ChannelFutureListener.CLOSE);
} Session getSession () throws InterruptedException {store.take ();
}
}com.gmail.dosofredriver.ajax.serviceserver.server.pipeline;com.gmail.dosofredriver.ajax.serviceserver.server.handlers.ConnectionFilter;com.gmail.dosofredriver.ajax.serviceserver.server.handlers.DataReader;com.gmail.dosofredriver.ajax.serviceserver.server.handlers.Decoder;com.gmail.dosofredriver.ajax.serviceserver.server.handlers.Encoder;org.jbossty.channel.ChannelPipeline;org.jbossty.channel.ChannelPipelineFactory;org.jbossty.channel.Channels;
/ **
* Date: 26.02.13
* Time: 23:26
*
* @ author DoSOfRR
* / class ServerPipelineFactory implements ChannelPipelineFactory {