org.apache.mina.core.service.IoService Java Examples

The following examples show how to use org.apache.mina.core.service.IoService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractIoSession.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * TODO Add method documentation
 */
protected AbstractIoSession(IoService service) {
    this.service = service;
    this.handler = service.getHandler();

    // Initialize all the Session counters to the current time
    long currentTime = System.currentTimeMillis();
    creationTime = currentTime;
    lastThroughputCalculationTime = currentTime;
    lastReadTime = currentTime;
    lastWriteTime = currentTime;
    lastIdleTimeForBoth = currentTime;
    lastIdleTimeForRead = currentTime;
    lastIdleTimeForWrite = currentTime;

    // TODO add documentation
    closeFuture.addListener(SCHEDULED_COUNTER_RESETTER);

    // Set a new ID for this session
    sessionId = idGenerator.incrementAndGet();
}
 
Example #2
Source File: DummySession.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the {@link IoService} which provides I/O service to this session.
 */
public void setService(IoService service) {
    if (service == null) {
        throw new IllegalArgumentException("service");
    }

    this.service = service;
}
 
Example #3
Source File: AbstractIoSession.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public SocketAddress getServiceAddress() {
    IoService service = getService();
    if (service instanceof IoAcceptor) {
        return ((IoAcceptor) service).getLocalAddress();
    }

    return getRemoteAddress();
}
 
Example #4
Source File: MulticastSocketSession.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
/**
    * Creates a new acceptor-side session instance.
    */
MulticastSocketSession(IoService service,
				MulticastSocket socket, IoProcessor<MulticastSocketSession> processor,
                       SocketAddress remoteAddress) 
   {
	super(service);
	
       this.service = service;
       this.socket = socket;
       this.config = new MulticastDatagramSessionConfig(socket);
       this.handler = service.getHandler();
       this.processor = processor;
       this.remoteAddress = (InetSocketAddress) remoteAddress;
       this.localAddress = (InetSocketAddress) socket.getLocalSocketAddress();
   }
 
Example #5
Source File: DefaultSocketSessionConfig.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public void init(IoService parent) {
    this.parent = parent;

    if (parent instanceof SocketAcceptor) {
        defaultReuseAddress = true;
    } else {
        defaultReuseAddress = DEFAULT_REUSE_ADDRESS;
    }

    reuseAddress = defaultReuseAddress;
}
 
Example #6
Source File: NioDatagramSession.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new acceptor-side session instance.
 */
NioDatagramSession(IoService service, DatagramChannel channel, IoProcessor<NioSession> processor,
        SocketAddress remoteAddress) {
    super(processor, service, channel);
    config = new NioDatagramSessionConfig(channel);
    config.setAll(service.getSessionConfig());
    this.remoteAddress = (InetSocketAddress) remoteAddress;
    this.localAddress = (InetSocketAddress) channel.socket().getLocalSocketAddress();
}
 
Example #7
Source File: VmPipeSession.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
VmPipeSession(IoService service, IoServiceListenerSupport serviceListeners, VmPipeAddress localAddress,
        IoHandler handler, VmPipe remoteEntry) {
    super(service);
    config = new DefaultVmPipeSessionConfig();
    this.serviceListeners = serviceListeners;
    lock = new ReentrantLock();
    this.localAddress = localAddress;
    remoteAddress = serviceAddress = remoteEntry.getAddress();
    filterChain = new VmPipeFilterChain(this);
    receivedMessageQueue = new LinkedBlockingQueue<Object>();

    remoteSession = new VmPipeSession(this, remoteEntry);
}
 
Example #8
Source File: MINAStatCollector.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public void serviceDeactivated(final IoService service) {
}
 
Example #9
Source File: WebSocketServerTest.java    From red5-websocket with Apache License 2.0 4 votes vote down vote up
@Override
public IoService getService() {
    // TODO Auto-generated method stub
    return null;
}
 
Example #10
Source File: TftpTransferProtocolHandler.java    From tftp4j with Apache License 2.0 4 votes vote down vote up
public TftpTransferProtocolHandler(@Nonnull IoService connector, @Nonnull TftpTransfer<IoSession> transfer) {
    this.connector = connector;
    this.transfer = transfer;
}
 
Example #11
Source File: MINAStatCollector.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public void serviceActivated(final IoService service) {
}
 
Example #12
Source File: MINAStatCollector.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public void serviceIdle(final IoService service, final IdleStatus idleStatus) {
}
 
Example #13
Source File: ServerListener.java    From oim-fx with MIT License 4 votes vote down vote up
@Override
public void serviceDeactivated(IoService service) throws Exception {
	logger.debug("service deactivated.............");
}
 
Example #14
Source File: MINAStatCollector.java    From Openfire with Apache License 2.0 4 votes vote down vote up
/**
 * Create a stat collector for the given service with a default polling time of 5 seconds.
 * @param service the IoService to inspect
 */
public MINAStatCollector( IoService service )
{
    this( service,5000 );
}
 
Example #15
Source File: MINAStatCollector.java    From Openfire with Apache License 2.0 4 votes vote down vote up
/**
 * create a stat collector for the given given service
 * @param service the IoService to inspect
 * @param pollingInterval milliseconds
 */
public MINAStatCollector( IoService service, int pollingInterval )
{
    this.service = service;
    this.pollingInterval = pollingInterval;
}
 
Example #16
Source File: DefaultSocketSessionConfig.java    From jane with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param p The parent IoService.
 */
public DefaultSocketSessionConfig(IoService p) {
	reuseAddress = defaultReuseAddress = (p instanceof NioSocketAcceptor || DEFAULT_REUSE_ADDRESS);
}
 
Example #17
Source File: NioSession.java    From jane with GNU Lesser General Public License v3.0 4 votes vote down vote up
SessionConfigImpl(IoService service) {
	setAll(service.getSessionConfig());
}
 
Example #18
Source File: DummySession.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public IoService getService() {
    return service;
}
 
Example #19
Source File: AbstractIoSession.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public IoService getService() {
    return service;
}
 
Example #20
Source File: NioDatagramSession.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates a new connector-side session instance.
 */
NioDatagramSession(IoService service, DatagramChannel channel, IoProcessor<NioSession> processor) {
    this(service, channel, processor, channel.socket().getRemoteSocketAddress());
}
 
Example #21
Source File: MulticastSocketSession.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
@Override
public IoService getService() {
       return service;
   }
 
Example #22
Source File: MulticastSocketSession.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
/**
    * Creates a new connector-side session instance.
    */
MulticastSocketSession(IoService service,
                       MulticastSocket socket, IoProcessor<MulticastSocketSession> processor) {
       this(service, socket, processor, socket.getRemoteSocketAddress());
   }
 
Example #23
Source File: ServerListener.java    From oim-fx with MIT License 4 votes vote down vote up
@Override
public void serviceIdle(IoService service, IdleStatus idle) throws Exception {
	logger.debug("session idle............." + idle.toString());
}
 
Example #24
Source File: ServerListener.java    From oim-fx with MIT License 4 votes vote down vote up
@Override
public void serviceActivated(IoService service) throws Exception {
	logger.debug("service Ativated.............");
}
 
Example #25
Source File: NioSession.java    From neoscada with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 
 * Creates a new instance of NioSession, with its associated IoProcessor.
 * <br>
 * This method is only called by the inherited class.
 *
 * @param processor The associated IoProcessor
 */
protected NioSession(IoProcessor<NioSession> processor, IoService service, Channel channel) {
    super(service);
    this.channel = channel;
    this.processor = processor;
    filterChain = new DefaultIoFilterChain(this);
}
 
Example #26
Source File: MockIOSession.java    From mapleLemon with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Does nothing.
 *
 * @return
 */
@Override
public IoService getService() {
    return null;
}
 
Example #27
Source File: IoSession.java    From neoscada with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * @return the {@link IoService} which provides I/O service to this session.
 */
IoService getService();
 
Example #28
Source File: NioSocketSession.java    From neoscada with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 
 * Creates a new instance of NioSocketSession.
 *
 * @param service the associated IoService 
 * @param processor the associated IoProcessor
 * @param ch the used channel
 */
public NioSocketSession(IoService service, IoProcessor<NioSession> processor, SocketChannel channel) {
    super(processor, service, channel);
    config = new SessionConfigImpl();
    this.config.setAll(service.getSessionConfig());
}
 
Example #29
Source File: IoSession.java    From jane with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * @return the {@link IoService} which provides I/O service to this session.
 */
IoService getService();