Permalink
Browse files

Fixed inability to pass underlying cause of a bind failure up chain t…

…o properly throw an SmppChannelException
  • Loading branch information...
1 parent 3306e1e commit ce1b815662b17248e3e039782eaeb5613087e4ff @jjlauer jjlauer committed Apr 29, 2011
View
@@ -1,18 +1,18 @@
run-client:
- mvn test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.ClientMain"
+ mvn -e test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.ClientMain"
run-server:
- mvn test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.ServerMain"
+ mvn -e test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.ServerMain"
run-simulator:
- mvn test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.SimulatorMain"
+ mvn -e test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.SimulatorMain"
run-rebind:
- mvn test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.RebindMain"
+ mvn -e test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.RebindMain"
run-parser:
- mvn test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.ParserMain"
+ mvn -e test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.ParserMain"
run-dlr:
- mvn test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.DeliveryReceiptMain"
+ mvn -e test-compile exec:java -Dexec.classpathScope="test" -Dexec.mainClass="com.cloudhopper.smpp.demo.DeliveryReceiptMain"
View
35 README
@@ -11,29 +11,52 @@ and suppliers around the world. It's effective at being flexible with SMPP
specifications that aren't truly compliant. The goal of the internal PDU
parser is to be unbreakable.
+
Installation
----------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
Binary builds are publicly available at the Cloudhopper Maven repo:
http://maven.cloudhopper.com/repos/third-party/cloudhopper
Source builds require a parent POM available in a project:
http://maven.cloudhopper.com/repos/third-party/cloudhopper/ch-maven-parent-public
+
+Demo Code / Tutorials
+--------------------------------------------------------------------------------
+
+For examples on using this library as a client or server, please see:
+ src/test/java/com/cloudhopper/smpp/demo
+
+To run some of the samples, there is a Makefile to automate running some of the
+Maven commands. On Linux/Mac, you'd run:
+
+ make run-server
+ make run-client
+
+On Windows, you'd run:
+
+ nmake run-server
+ nmake run-client
+
+
Contributors
----------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+Joe Lauer (follow me on twitter http://twitter.com/jjlauer)
-Joe Lauer
License
----------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
Copyright (C) 2011 Twitter, Inc.
-This work is licensed under the Apache License, Version 2.0. See LICENSE for details.
+This work is licensed under the Apache License, Version 2.0. See LICENSE for
+details.
+
What do we need help with?
----------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
There are always additional non-compliant SMPP implementations that exist out
in the wild. Here are a few ways you can help us:
View
@@ -1,7 +1,15 @@
-Cloudhopper, Inc.
+Twitter, Inc. (formerly created by Cloudhopper, Inc.)
+http://twitter.com/
http://www.cloudhopper.com/
SMPP Library
--------------------------------------------------------------------------------
+3.2 - 2011-04-28
+ * Upgraded netty dependency from 3.1.5 to 3.2.4 (to keep it current, not to
+ fix any specific problem)
+ * Upgraded joda-time dependency from 1.6 to 1.6.2 (to keep it current)
+ * Upgraded ch-commons-util dependency from 4.0 to 4.1
+
+
3.1 - 2011-03-14
* Removed debug logging from DeliveryReceipt parser.
View
@@ -7,7 +7,7 @@
<groupId>cloudhopper</groupId>
<artifactId>ch-smpp</artifactId>
<packaging>jar</packaging>
- <version>3.1</version>
+ <version>3.2</version>
<name>ch-smpp</name>
<parent>
@@ -34,6 +34,10 @@
</plugins>
</build>
+ <!--
+ I prefer jars managed out of the Cloudhopper Maven Repo with more consistent
+ versioning. I apologize for not using more common Maven repos
+ -->
<dependencies>
<!-- compile scope -->
<dependency>
@@ -47,7 +51,7 @@
<version>${ch-commons-util.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.netty</groupId>
+ <groupId>jboss</groupId>
<artifactId>netty</artifactId>
<version>${netty.version}</version>
</dependency>
@@ -93,6 +97,7 @@
</dependencies>
<properties>
+ <netty.version>[3.2,)</netty.version>
<ch-commons-charset.version>[2.0,)</ch-commons-charset.version>
<ch-commons-gsm.version>[2.0,)</ch-commons-gsm.version>
<ch-commons-util.version>[4.0,)</ch-commons-util.version>
@@ -92,11 +92,13 @@ protected void log(Direction direction, ChannelEvent evt) {
}
}
+ @Override
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
log(Direction.UP, e);
ctx.sendUpstream(e);
}
+ @Override
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
log(Direction.DOWN, e);
ctx.sendDownstream(e);
@@ -45,6 +45,7 @@ public void setThreadName(String value) {
this.threadName = value;
}
+ @Override
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
// always rename the current thread and then rename it back
String currentThreadName = Thread.currentThread().getName();
@@ -83,6 +83,7 @@ public DefaultSmppClient(ExecutorService executors, int expectedSessions) {
this.clientBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_CLIENT_CONNECTOR_NAME, this.clientConnector);
}
+ @Override
public void shutdown() {
// close all channels still open within this session "bootstrap"
this.channels.close().awaitUninterruptibly();
@@ -134,6 +135,7 @@ public SmppSession bind(SmppSessionConfiguration config) throws SmppTimeoutExcep
* @throws InterruptedException Thrown if the calling thread is interrupted
* while we are attempting the bind.
*/
+ @Override
public SmppSession bind(SmppSessionConfiguration config, SmppSessionHandler sessionHandler) throws SmppTimeoutException, SmppChannelException, SmppBindException, UnrecoverablePduException, InterruptedException {
DefaultSmppSession session = null;
try {
@@ -37,9 +37,11 @@
import java.util.Timer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.group.ChannelGroup;
import org.jboss.netty.channel.group.DefaultChannelGroup;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
@@ -61,7 +63,7 @@
private final PduTranscoder transcoder;
private ExecutorService bossThreadPool;
- private NioServerSocketChannelFactory channelFactory;
+ private ChannelFactory channelFactory;
private ServerBootstrap serverBootstrap;
private Channel serverChannel;
@@ -74,7 +76,7 @@ public DefaultSmppServer(SmppServerConfiguration configuration, SmppServerHandle
this(configuration, DaemonExecutors.newCachedDaemonThreadPool(), serverHandler);
}
- public DefaultSmppServer(SmppServerConfiguration configuration, ExecutorService executors, SmppServerHandler serverHandler) {
+ public DefaultSmppServer(final SmppServerConfiguration configuration, ExecutorService executors, SmppServerHandler serverHandler) {
this.configuration = configuration;
// the same group we'll put every server channel
this.channels = new DefaultChannelGroup();
@@ -99,6 +101,7 @@ public PduTranscoder getTranscoder() {
return this.transcoder;
}
+ @Override
public ChannelGroup getChannels() {
return this.channels;
}
@@ -111,10 +114,12 @@ public Timer getBindTimer() {
return this.bindTimer;
}
+ @Override
public void start() {
serverChannel = this.serverBootstrap.bind(new InetSocketAddress(configuration.getPort()));
}
+ @Override
public void stop() {
// close all channels still open within this session "bootstrap"
this.channels.close().awaitUninterruptibly();
@@ -129,7 +134,6 @@ protected Long nextSessionId() {
return this.sessionIdSequence.getAndIncrement();
}
-
protected byte autoNegotiateInterfaceVersion(byte requestedInterfaceVersion) {
if (!this.configuration.isAutoNegotiateInterfaceVersion()) {
return requestedInterfaceVersion;
Oops, something went wrong.

0 comments on commit ce1b815

Please sign in to comment.