Search in sources :

Example 1 with AbstractSessionStateManager

use of com.zx.sms.session.AbstractSessionStateManager in project SMSGate by Lihuanghe.

the class AbstractEndpointConnector method synwrite.

public <T extends BaseMessage> List<Promise<T>> synwrite(List<T> msgs) {
    Channel ch = fetchOneWritable();
    if (ch == null)
        return null;
    AbstractSessionStateManager session = (AbstractSessionStateManager) ch.pipeline().get(sessionHandler);
    if (session == null)
        return null;
    List<Promise<T>> arrPromise = new ArrayList<Promise<T>>();
    for (BaseMessage msg : msgs) {
        arrPromise.add(session.writeMessagesync(msg));
    }
    return arrPromise;
}
Also used : Promise(io.netty.util.concurrent.Promise) BaseMessage(com.zx.sms.BaseMessage) Channel(io.netty.channel.Channel) ArrayList(java.util.ArrayList) AbstractSessionStateManager(com.zx.sms.session.AbstractSessionStateManager)

Example 2 with AbstractSessionStateManager

use of com.zx.sms.session.AbstractSessionStateManager in project SMSGate by Lihuanghe.

the class AbstractEndpointConnector method synwrite.

public <T extends BaseMessage> Promise<T> synwrite(T message) {
    Channel ch = fetchOneWritable();
    if (ch == null)
        return null;
    AbstractSessionStateManager session = (AbstractSessionStateManager) ch.pipeline().get(sessionHandler);
    return session.writeMessagesync(message);
}
Also used : Channel(io.netty.channel.Channel) AbstractSessionStateManager(com.zx.sms.session.AbstractSessionStateManager)

Aggregations

AbstractSessionStateManager (com.zx.sms.session.AbstractSessionStateManager)2 Channel (io.netty.channel.Channel)2 BaseMessage (com.zx.sms.BaseMessage)1 Promise (io.netty.util.concurrent.Promise)1 ArrayList (java.util.ArrayList)1