本文整理汇总了Java中org.jsmpp.extra.SessionState类的典型用法代码示例。如果您正苦于以下问题:Java SessionState类的具体用法?Java SessionState怎么用?Java SessionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionState类属于org.jsmpp.extra包,在下文中一共展示了SessionState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SmppProducer
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public SmppProducer(SmppEndpoint endpoint, SmppConfiguration config) {
super(endpoint);
this.configuration = config;
this.internalSessionStateListener = new SessionStateListener() {
@Override
public void onStateChange(SessionState newState, SessionState oldState, Session source) {
if (configuration.getSessionStateListener() != null) {
configuration.getSessionStateListener().onStateChange(newState, oldState, source);
}
if (newState.equals(SessionState.CLOSED)) {
LOG.warn("Lost connection to: {} - trying to reconnect...", getEndpoint().getConnectionString());
closeSession();
reconnect(configuration.getInitialReconnectDelay());
}
}
};
}
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:SmppProducer.java
示例2: SmppConsumer
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
/**
* The constructor which gets a smpp endpoint, a smpp configuration and a
* processor
*/
public SmppConsumer(SmppEndpoint endpoint, SmppConfiguration config, Processor processor) {
super(endpoint, processor);
this.configuration = config;
this.internalSessionStateListener = new SessionStateListener() {
@Override
public void onStateChange(SessionState newState, SessionState oldState, Session source) {
if (configuration.getSessionStateListener() != null) {
configuration.getSessionStateListener().onStateChange(newState, oldState, source);
}
if (newState.equals(SessionState.CLOSED)) {
LOG.warn("Lost connection to: {} - trying to reconnect...", getEndpoint().getConnectionString());
closeSession();
reconnect(configuration.getInitialReconnectDelay());
}
}
};
this.messageReceiverListener = new MessageReceiverListenerImpl(getEndpoint(), getProcessor(), getExceptionHandler());
}
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:SmppConsumer.java
示例3: changeState
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
@Override
protected void changeState(SessionState newState) {
if (!stateProcessor.getSessionState().equals(newState)) {
final SessionState oldState = stateProcessor.getSessionState();
// change the session state processor
if (newState == SessionState.OPEN) {
stateProcessor = SMPPSessionState.OPEN;
} else if (newState == SessionState.BOUND_RX) {
stateProcessor = SMPPSessionState.BOUND_RX;
} else if (newState == SessionState.BOUND_TX) {
stateProcessor = SMPPSessionState.BOUND_TX;
} else if (newState == SessionState.BOUND_TRX) {
stateProcessor = SMPPSessionState.BOUND_TRX;
} else if (newState == SessionState.UNBOUND) {
stateProcessor = SMPPSessionState.UNBOUND;
} else if (newState == SessionState.CLOSED) {
stateProcessor = SMPPSessionState.CLOSED;
}
fireStateChanged(newState, oldState, smppSession);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:23,代码来源:SMPPSessionContext.java
示例4: onStateChange
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public void onStateChange(SessionState newState, SessionState oldState,
Session source) {
/*
* We need to set SO_TIMEOUT to sessionTimer so when timeout occur,
* a SocketTimeoutException will be raised. When Exception raised we
* can send an enquireLinkCommand.
*/
if (newState.isBound()) {
try {
conn.setSoTimeout(getEnquireLinkTimer());
} catch (IOException e) {
logger.error("Failed setting so_timeout for session timer", e);
}
logger.info("Changing processor degree to {}", getPduProcessorDegree());
((ThreadPoolExecutor)pduReaderWorker.executorService).setCorePoolSize(getPduProcessorDegree());
((ThreadPoolExecutor)pduReaderWorker.executorService).setMaximumPoolSize(getPduProcessorDegree());
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:20,代码来源:SMPPSession.java
示例5: changeState
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
@Override
protected void changeState(SessionState newState) {
if (!stateProcessor.getSessionState().equals(newState)) {
final SessionState oldState = stateProcessor.getSessionState();
// change the session state processor
if (newState == SessionState.OPEN) {
stateProcessor = SMPPOutboundServerSessionState.OPEN;
} else if (newState == SessionState.OUTBOUND) {
stateProcessor = SMPPOutboundServerSessionState.OUTBOUND;
} else if (newState == SessionState.BOUND_RX) {
stateProcessor = SMPPOutboundServerSessionState.BOUND_RX;
} else if (newState == SessionState.BOUND_TX) {
stateProcessor = SMPPOutboundServerSessionState.BOUND_TX;
} else if (newState == SessionState.BOUND_TRX) {
stateProcessor = SMPPOutboundServerSessionState.BOUND_TRX;
} else if (newState == SessionState.UNBOUND) {
stateProcessor = SMPPOutboundServerSessionState.UNBOUND;
} else if (newState == SessionState.CLOSED) {
stateProcessor = SMPPOutboundServerSessionState.CLOSED;
}
fireStateChanged(newState, oldState, smppSession);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:25,代码来源:OutboundSMPPServerSessionContext.java
示例6: onStateChange
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public void onStateChange(SessionState newState, SessionState oldState,
Session source) {
/**
* We need to set SO_TIMEOUT to sessionTimer so when timeout occur,
* a SocketTimeoutException will be raised. When Exception raised we
* can send an enquireLinkCommand.
*/
if (newState.isBound()) {
try {
conn.setSoTimeout(getEnquireLinkTimer());
}
catch (IOException e) {
logger.error("Failed setting so_timeout for session timer", e);
}
logger.info("Changing processor degree to {}", getPduProcessorDegree());
((ThreadPoolExecutor) pduReaderWorker.executorService).setCorePoolSize(getPduProcessorDegree());
((ThreadPoolExecutor) pduReaderWorker.executorService).setMaximumPoolSize(getPduProcessorDegree());
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:21,代码来源:SMPPOutboundSession.java
示例7: changeState
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
@Override
protected void changeState(SessionState newState) {
if (!stateProcessor.getSessionState().equals(newState)) {
final SessionState oldState = stateProcessor.getSessionState();
// change the session state processor
if (newState == SessionState.OPEN) {
stateProcessor = SMPPServerSessionState.OPEN;
} else if (newState == SessionState.BOUND_RX) {
stateProcessor = SMPPServerSessionState.BOUND_RX;
} else if (newState == SessionState.BOUND_TX) {
stateProcessor = SMPPServerSessionState.BOUND_TX;
} else if (newState == SessionState.BOUND_TRX) {
stateProcessor = SMPPServerSessionState.BOUND_TRX;
} else if (newState == SessionState.UNBOUND) {
stateProcessor = SMPPServerSessionState.UNBOUND;
} else if (newState == SessionState.CLOSED) {
stateProcessor = SMPPServerSessionState.CLOSED;
}
fireStateChanged(newState, oldState, smppServerSession);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:23,代码来源:SMPPServerSessionContext.java
示例8: changeState
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
@Override
protected void changeState(SessionState newState) {
if (!stateProcessor.getSessionState().equals(newState)) {
final SessionState oldState = stateProcessor.getSessionState();
// change the session state processor
if (newState == SessionState.OPEN) {
stateProcessor = SMPPOutboundSessionState.OPEN;
} else if (newState == SessionState.BOUND_RX) {
stateProcessor = SMPPOutboundSessionState.BOUND_RX;
} else if (newState == SessionState.BOUND_TX) {
stateProcessor = SMPPOutboundSessionState.BOUND_TX;
} else if (newState == SessionState.BOUND_TRX) {
stateProcessor = SMPPOutboundSessionState.BOUND_TRX;
} else if (newState == SessionState.UNBOUND) {
stateProcessor = SMPPOutboundSessionState.UNBOUND;
} else if (newState == SessionState.CLOSED) {
stateProcessor = SMPPOutboundSessionState.CLOSED;
}
fireStateChanged(newState, oldState, smppSession);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:23,代码来源:SMPPOutboundSessionContext.java
示例9: run
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public void run() {
try {
Thread.sleep(WAIT_DURATION);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
LOG.error("Sleep interrupted", e1);
}
SessionState state = session.getSessionState();
if (!state.isReceivable()) {
LOG.debug("Not sending delivery receipt for message id {} since session state is {}", messageId, state);
return;
}
String stringValue = Integer.valueOf(messageId.getValue(), TWO_BYTES).toString();
try {
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, totalSubmitted, totalDelivered, new Date(), new Date(), DeliveryReceiptState.DELIVRD, null, new String(shortMessage));
session.deliverShortMessage("mc", sourceAddrTon, sourceAddrNpi, sourceAddress, destAddrTon, destAddrNpi, destAddress, new ESMClass(MessageMode.DEFAULT,
MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT), (byte) 0, (byte) 0, new RegisteredDelivery(0), DataCodings.ZERO, delRec.toString().getBytes());
LOG.debug("Sending delivery receipt for message id {}: {}", messageId, stringValue);
} catch (Exception e) {
LOG.error("Failed sending delivery_receipt for message id {}: {}", messageId, stringValue, e);
}
}
开发者ID:groupe-sii,项目名称:ogham,代码行数:24,代码来源:DeliveryReceiptTask.java
示例10: setNoneDefaultValues
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
private void setNoneDefaultValues(SmppConfiguration config) {
config.setDestAddr("1919");
config.setDestAddrNpi(NumberingPlanIndicator.NATIONAL.value());
config.setDestAddrTon(TypeOfNumber.NATIONAL.value());
config.setEnquireLinkTimer(new Integer(5001));
config.setHost("127.0.0.1");
config.setPassword("secret");
config.setPort(new Integer(2776));
config.setPriorityFlag((byte) 0);
config.setProtocolId((byte) 1);
config.setRegisteredDelivery(SMSCDeliveryReceipt.DEFAULT.value());
config.setReplaceIfPresentFlag((byte) 1);
config.setServiceType("XXX");
config.setSourceAddr("1818");
config.setSourceAddrNpi(NumberingPlanIndicator.NATIONAL.value());
config.setSourceAddrTon(TypeOfNumber.NATIONAL.value());
config.setSystemId("client");
config.setSystemType("xx");
config.setTransactionTimer(new Integer(10001));
config.setEncoding("UTF-8");
config.setNumberingPlanIndicator(NumberingPlanIndicator.NATIONAL.value());
config.setTypeOfNumber(TypeOfNumber.NATIONAL.value());
config.setUsingSSL(true);
config.setInitialReconnectDelay(5001);
config.setReconnectDelay(5002);
config.setHttpProxyHost("127.0.0.1");
config.setHttpProxyPort(new Integer(3129));
config.setHttpProxyUsername("user");
config.setHttpProxyPassword("secret");
config.setSessionStateListener(new SessionStateListener() {
public void onStateChange(SessionState arg0, SessionState arg1, Session arg2) {
}
});
Map<String, String> proxyHeaders = new HashMap<String, String>();
proxyHeaders.put("X-Proxy-Header", "1");
config.setProxyHeaders(proxyHeaders);
}
开发者ID:HydAu,项目名称:Camel,代码行数:38,代码来源:SmppConfigurationTest.java
示例11: createEndpointWithSessionStateListener
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
@Test
public void createEndpointWithSessionStateListener() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("sessionStateListener", new SessionStateListener() {
@Override
public void onStateChange(SessionState arg0, SessionState arg1, Session arg2) {
}
});
context.setRegistry(registry);
component = new SmppComponent(context);
SmppEndpoint endpoint = (SmppEndpoint) component.createEndpoint("smpp://[email protected]:2775?password=password&sessionStateListener=#sessionStateListener");
assertNotNull(endpoint.getConfiguration().getSessionStateListener());
}
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:SmppComponentTest.java
示例12: sendOutbind
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public void sendOutbind(String systemId, String password) throws IOException {
if (sessionContext().getSessionState().equals(SessionState.CLOSED)) {
throw new IOException("Session " + sessionId + " is closed");
}
OutbindCommandTask task = new OutbindCommandTask(pduSender, systemId, password);
try {
executeSendCommandWithNoResponse(task);
} catch (PDUException e) {
// exception should be never caught since we didn't send any string parameter.
logger.warn("PDU String should be always valid", e);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:15,代码来源:AbstractSession.java
示例13: ensureReceivable
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
/**
* Ensure the session is receivable. If the session not receivable then an
* exception thrown.
*
* @param activityName is the activity name.
* @throws IOException if the session not receivable.
*/
protected void ensureReceivable(String activityName) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isReceivable()) {
throw new IOException("Cannot " + activityName + " while session " + sessionId + " in state " + currentState);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:15,代码来源:AbstractSession.java
示例14: bound
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public synchronized void bound(BindType bindType) {
if (bindType.equals(BindType.BIND_TX)) {
changeState(SessionState.BOUND_TX);
} else if (bindType.equals(BindType.BIND_RX)) {
changeState(SessionState.BOUND_RX);
} else if (bindType.equals(BindType.BIND_TRX)) {
changeState(SessionState.BOUND_TRX);
} else {
throw new IllegalArgumentException("Bind type " + bindType + " not supported");
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:12,代码来源:AbstractSessionContext.java
示例15: fireStateChanged
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
protected void fireStateChanged(SessionState newState,
SessionState oldState, Session source) {
for (SessionStateListener l : sessionStateListeners) {
try {
l.onStateChange(newState, oldState, source);
} catch (Exception e) {
logger.error("Invalid runtime exception thrown when calling onStateChange for " + source, e);
}
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:13,代码来源:AbstractSessionContext.java
示例16: onStateChange
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public void onStateChange(SessionState newState, SessionState oldState, Session source) {
LOGGER.debug("State changed from {} to {}",oldState , newState);
if (newState.equals(SessionState.CLOSED)) {
LOGGER.info("Session {} closed", source.getSessionId());
reconnectAfter(reconnectInterval);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:8,代码来源:AutoReconnectGateway.java
示例17: run
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
LOGGER.error("Interupted", e1);
}
SessionState state = session.getSessionState();
if (!state.isReceivable()) {
LOGGER.debug("Not sending delivery receipt for message id {} since session state is {}", messageId, state);
return;
}
String stringValue = Integer.valueOf(messageId.getValue(), 16).toString();
try {
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, totalSubmitted, totalDelivered, new Date(), new Date(), DeliveryReceiptState.DELIVRD, "000", new String(shortMessage));
session.deliverShortMessage(
"mc",
sourceAddrTon, sourceAddrNpi, sourceAddress,
destAddrTon, destAddrNpi, destAddress,
new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT),
(byte)0,
(byte)0,
new RegisteredDelivery(0),
DataCodings.ZERO,
delRec.toString().getBytes());
LOGGER.debug("Sending delivery receipt for message id {}: {}", messageId, stringValue);
} catch (Exception e) {
LOGGER.error("Failed sending delivery_receipt for message id " + messageId + ":" + stringValue, e);
}
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:31,代码来源:SMPPServerSimulator.java
示例18: fireStateChanged
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
protected void fireStateChanged(SessionState newState,
SessionState oldState, Object source) {
for (SessionStateListener l : sessionStateListeners) {
try {
l.onStateChange(newState, oldState, source);
} catch (Exception e) {
logger.error("Invalid runtime exception thrown when calling onStateChange for " + source, e);
}
}
}
开发者ID:apache,项目名称:servicemix-bundles,代码行数:13,代码来源:AbstractSessionContext.java
示例19: getSessionState
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public synchronized SessionState getSessionState() {
return stateProcessor.getSessionState();
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:4,代码来源:SMPPSessionContext.java
示例20: getSessionState
import org.jsmpp.extra.SessionState; //导入依赖的package包/类
public SessionState getSessionState() {
return sessionContext().getSessionState();
}
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:4,代码来源:AbstractSession.java
注:本文中的org.jsmpp.extra.SessionState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论