use of org.jpos.util.ThreadPool in project jPOS by jpos.
the class QServer method initServer.
private void initServer() throws ConfigurationException {
if (port == 0) {
throw new ConfigurationException("Port value not set");
}
newChannel();
if (channel == null) {
throw new ConfigurationException("ISO Channel is null");
}
if (!(channel instanceof ServerChannel)) {
throw new ConfigurationException(channelString + "does not implement ServerChannel");
}
ThreadPool pool = null;
pool = new ThreadPool(minSessions, maxSessions, getName() + "-ThreadPool");
pool.setLogger(log.getLogger(), getName() + ".pool");
server = new ISOServer(port, (ServerChannel) channel, pool);
server.setLogger(log.getLogger(), getName() + ".server");
server.setName(getName());
if (socketFactoryString != null) {
ISOServerSocketFactory sFac = (ISOServerSocketFactory) getFactory().newInstance(socketFactoryString);
if (sFac != null && sFac instanceof LogSource) {
((LogSource) sFac).setLogger(log.getLogger(), getName() + ".socket-factory");
}
server.setSocketFactory(sFac);
}
getFactory().setConfiguration(server, getPersist());
addServerSocketFactory();
// ISORequestListener
addListeners();
addISOServerConnectionListeners();
NameRegistrar.register(getName(), this);
new Thread(server).start();
}
use of org.jpos.util.ThreadPool in project jPOS by jpos.
the class SslChannelIntegrationTest method newIsoServer.
private ISOServer newIsoServer() throws IOException, ISOException {
XMLChannel clientSide = new XMLChannel(new XMLPackager());
clientSide.setLogger(logger, "server.channel");
ISOServer isoServer = new ISOServer(PORT, clientSide, new ThreadPool());
isoServer.setSocketFactory(new SunJSSESocketFactory());
isoServer.setConfiguration(serverConfiguration());
isoServer.setLogger(logger, "server");
isoServer.addISORequestListener(new TestListener());
return isoServer;
}
use of org.jpos.util.ThreadPool in project jPOS by jpos.
the class DirPollAdaptor method initService.
protected void initService() throws Exception {
QFactory factory = getServer().getFactory();
dirPoll = createDirPoll();
dirPoll.setPath(getPath());
dirPoll.setThreadPool(new ThreadPool(1, poolSize));
dirPoll.setPollInterval(pollInterval);
if (priorities != null)
dirPoll.setPriorities(priorities);
dirPoll.setLogger(getLog().getLogger(), getLog().getRealm());
Configuration cfg = factory.getConfiguration(getPersist());
dirPoll.setConfiguration(cfg);
dirPoll.createDirs();
Object dpp = factory.newInstance(getProcessor());
if (dpp instanceof LogSource) {
((LogSource) dpp).setLogger(getLog().getLogger(), getLog().getRealm());
}
if (dpp instanceof Configurable) {
((Configurable) dpp).setConfiguration(cfg);
}
dirPoll.setProcessor(dpp);
}
Aggregations