当前位置: 首页>>代码示例>>Java>>正文


Java IoSession.removeAttribute方法代码示例

本文整理汇总了Java中org.apache.mina.core.session.IoSession.removeAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IoSession.removeAttribute方法的具体用法?Java IoSession.removeAttribute怎么用?Java IoSession.removeAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.mina.core.session.IoSession的用法示例。


在下文中一共展示了IoSession.removeAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sessionClosed

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void sessionClosed(IoSession session) throws Exception {
    MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
    if (client != null) {
        try {
            boolean inCashShop = false;
            if (client.getPlayer() != null) {
                inCashShop = client.getPlayer().getCashShop().isOpened();                  
            }
            client.disconnect(false, inCashShop);
        } catch (Throwable t) {
            FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, t);
        } finally {
            session.close();
            session.removeAttribute(MapleClient.CLIENT_KEY);
            //client.empty();
        }
    }
    super.sessionClosed(session);
}
 
开发者ID:NovaStory,项目名称:AeroStory,代码行数:21,代码来源:MapleServerHandler.java

示例2: doFilterWrite

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
protected Object doFilterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest)
        throws IOException {
    if (!compressOutbound) {
        return null;
    }

    if (session.containsAttribute(DISABLE_COMPRESSION_ONCE)) {
        // Remove the marker attribute because it is temporary.
        session.removeAttribute(DISABLE_COMPRESSION_ONCE);
        return null;
    }

    Zlib deflater = (Zlib) session.getAttribute(DEFLATER);
    if (deflater == null) {
        throw new IllegalStateException();
    }

    IoBuffer inBuffer = (IoBuffer) writeRequest.getMessage();
    if (!inBuffer.hasRemaining()) {
        // Ignore empty buffers
        return null;
    } else {
        return deflater.deflate(inBuffer);
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:27,代码来源:CompressionFilter.java

示例3: finishDecode

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void finishDecode ( final IoSession session, final ProtocolDecoderOutput out ) throws Exception
{
    // remove the context from the session and kill the cyclic check
    final Context ctx = (Context)session.removeAttribute ( CONTEXT );
    if ( ctx != null )
    {
        unregisterContext ( ctx );
        ctx.dispose ();
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:TimedEndDecoder.java

示例4: execute

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
public void execute(NextCommand next, IoSession session, Object message) throws Exception {
    if (next != null) {
        session.setAttribute(NEXT_COMMAND, next);
    }

    try {
        callNextCommand(head, session, message);
    } finally {
        session.removeAttribute(NEXT_COMMAND);
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:IoHandlerChain.java

示例5: messageSent

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception {
    T stream = getMessageClass().cast(session.getAttribute(CURRENT_STREAM));

    if (stream == null) {
        nextFilter.messageSent(session, writeRequest);
    } else {
        IoBuffer buffer = getNextBuffer(stream);

        if (buffer == null) {
            // End of stream reached.
            session.removeAttribute(CURRENT_STREAM);
            WriteRequest currentWriteRequest = (WriteRequest) session.removeAttribute(CURRENT_WRITE_REQUEST);

            // Write queued WriteRequests.
            Queue<WriteRequest> queue = removeWriteRequestQueue(session);
            if (queue != null) {
                WriteRequest wr = queue.poll();
                while (wr != null) {
                    filterWrite(nextFilter, session, wr);
                    wr = queue.poll();
                }
            }

            currentWriteRequest.getFuture().setWritten();
            nextFilter.messageSent(session, currentWriteRequest);
        } else {
            nextFilter.filterWrite(session, new DefaultWriteRequest(buffer));
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:32,代码来源:AbstractStreamWriteFilter.java

示例6: sessionIdle

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception {
    if (status == interestedIdleStatus) {
        if (!session.containsAttribute(WAITING_FOR_RESPONSE)) {
            Object pingMessage = messageFactory.getRequest(session);
            if (pingMessage != null) {
                nextFilter.filterWrite(session, new DefaultWriteRequest(pingMessage));

                // If policy is OFF, there's no need to wait for
                // the response.
                if (getRequestTimeoutHandler() != KeepAliveRequestTimeoutHandler.DEAF_SPEAKER) {
                    markStatus(session);
                    if (interestedIdleStatus == IdleStatus.BOTH_IDLE) {
                        session.setAttribute(IGNORE_READER_IDLE_ONCE);
                    }
                } else {
                    resetStatus(session);
                }
            }
        } else {
            handlePingTimeout(session);
        }
    } else if (status == IdleStatus.READER_IDLE) {
        if (session.removeAttribute(IGNORE_READER_IDLE_ONCE) == null) {
            if (session.containsAttribute(WAITING_FOR_RESPONSE)) {
                handlePingTimeout(session);
            }
        }
    }

    if (forwardEvent) {
        nextFilter.sessionIdle(session, status);
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:35,代码来源:KeepAliveFilter.java

示例7: sessionCreated

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception {
    try {
        session.getHandler().sessionCreated(session);
    } finally {
        // Notify the related future.
        ConnectFuture future = (ConnectFuture) session.removeAttribute(SESSION_CREATED_FUTURE);
        if (future != null) {
            future.setSession(session);
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:13,代码来源:DefaultIoFilterChain.java

示例8: onPreRemove

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void onPreRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException {
    IoSession session = parent.getSession();
    stopSsl(session);
    session.removeAttribute(NEXT_FILTER);
    session.removeAttribute(SSL_HANDLER);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:8,代码来源:SslFilter.java

示例9: disposeEncoder

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
/**
 * Dispose the encoder, removing its instance from the
 * session's attributes, and calling the associated
 * dispose method.
 */
private void disposeEncoder(IoSession session) {
    ProtocolEncoder encoder = (ProtocolEncoder) session.removeAttribute(ENCODER);
    if (encoder == null) {
        return;
    }

    try {
        encoder.dispose(session);
    } catch (Throwable t) {
        LOGGER.warn("Failed to dispose: " + encoder.getClass().getName() + " (" + encoder + ')');
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:ProtocolCodecFilter.java

示例10: disposeDecoder

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
/**
 * Dispose the decoder, removing its instance from the
 * session's attributes, and calling the associated
 * dispose method.
 */
private void disposeDecoder(IoSession session) {
    ProtocolDecoder decoder = (ProtocolDecoder) session.removeAttribute(DECODER);
    if (decoder == null) {
        return;
    }

    try {
        decoder.dispose(session);
    } catch (Throwable t) {
        LOGGER.warn("Failed to dispose: " + decoder.getClass().getName() + " (" + decoder + ')');
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:ProtocolCodecFilter.java

示例11: dispose

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void dispose ( final IoSession session ) throws Exception
{
    // remove the context from the session and kill the cyclic check
    final Context ctx = (Context)session.getAttribute ( CONTEXT );
    if ( ctx != null )
    {
        unregisterContext ( ctx );
        ctx.dispose ();
        session.removeAttribute ( CONTEXT );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:13,代码来源:TimedEndDecoder.java

示例12: dispose

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void dispose(IoSession session) throws Exception {
    Context ctx = (Context) session.getAttribute(CONTEXT);

    if (ctx != null) {
        session.removeAttribute(CONTEXT);
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:TextLineDecoder.java

示例13: clearSessionBuffer

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
private void clearSessionBuffer ( final IoSession session )
{
    // simply remove the session buffer
    session.removeAttribute ( SESSION_BUFFER_ATTR );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:TPKTFilter.java

示例14: removeWriteRequestQueue

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Queue<WriteRequest> removeWriteRequestQueue(IoSession session) {
    return (Queue<WriteRequest>) session.removeAttribute(WRITE_REQUEST_QUEUE);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:5,代码来源:AbstractStreamWriteFilter.java

示例15: resetStatus

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
private void resetStatus(IoSession session) {
    session.getConfig().setReaderIdleTime(0);
    session.getConfig().setWriterIdleTime(0);
    session.getConfig().setIdleTime(interestedIdleStatus, getRequestInterval());
    session.removeAttribute(WAITING_FOR_RESPONSE);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:7,代码来源:KeepAliveFilter.java


注:本文中的org.apache.mina.core.session.IoSession.removeAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。