Clean up some imports and get rid of some warnings throught the code.

This commit is contained in:
Timothy Bish 2014-03-07 18:12:04 -05:00
parent ddf0b2a309
commit da5d0d819e
8 changed files with 14 additions and 21 deletions

View File

@ -27,6 +27,7 @@ import javax.jms.TemporaryQueue;
import javax.jms.TemporaryTopic; import javax.jms.TemporaryTopic;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import org.apache.activemq.command.ActiveMQBytesMessage; import org.apache.activemq.command.ActiveMQBytesMessage;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMapMessage; import org.apache.activemq.command.ActiveMQMapMessage;
@ -80,11 +81,11 @@ public class ActiveMQJMSVendor extends JMSVendor {
} }
@Override @Override
@SuppressWarnings("deprecation")
public Destination createDestination(String name) { public Destination createDestination(String name) {
return super.createDestination(name, Destination.class); return super.createDestination(name, Destination.class);
} }
@Override
public <T extends Destination> T createDestination(String name, Class<T> kind) { public <T extends Destination> T createDestination(String name, Class<T> kind) {
if( kind == Queue.class ) { if( kind == Queue.class ) {
return kind.cast(new ActiveMQQueue(name)); return kind.cast(new ActiveMQQueue(name));

View File

@ -38,14 +38,12 @@ import org.apache.activemq.util.IOExceptionSupport;
import org.apache.activemq.util.ServiceStopper; import org.apache.activemq.util.ServiceStopper;
import org.apache.activemq.wireformat.WireFormat; import org.apache.activemq.wireformat.WireFormat;
import org.fusesource.hawtbuf.Buffer; import org.fusesource.hawtbuf.Buffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* An implementation of the {@link org.apache.activemq.transport.Transport} interface for using AMQP over NIO * An implementation of the {@link org.apache.activemq.transport.Transport} interface for using AMQP over NIO
*/ */
public class AmqpNioTransport extends TcpTransport { public class AmqpNioTransport extends TcpTransport {
private DataInputStream amqpHeaderValue = new DataInputStream(new ByteArrayInputStream(new byte[]{'A', 'M', 'Q', 'P'})); private final DataInputStream amqpHeaderValue = new DataInputStream(new ByteArrayInputStream(new byte[]{'A', 'M', 'Q', 'P'}));
private final Integer AMQP_HEADER_VALUE = amqpHeaderValue.readInt(); private final Integer AMQP_HEADER_VALUE = amqpHeaderValue.readInt();
private SocketChannel channel; private SocketChannel channel;
@ -61,17 +59,20 @@ public class AmqpNioTransport extends TcpTransport {
super(wireFormat, socket); super(wireFormat, socket);
} }
@Override
protected void initializeStreams() throws IOException { protected void initializeStreams() throws IOException {
channel = socket.getChannel(); channel = socket.getChannel();
channel.configureBlocking(false); channel.configureBlocking(false);
// listen for events telling us when the socket is readable. // listen for events telling us when the socket is readable.
selection = SelectorManager.getInstance().register(channel, new SelectorManager.Listener() { selection = SelectorManager.getInstance().register(channel, new SelectorManager.Listener() {
@Override
public void onSelect(SelectorSelection selection) { public void onSelect(SelectorSelection selection) {
if (!isStopped()) { if (!isStopped()) {
serviceRead(); serviceRead();
} }
} }
@Override
public void onError(SelectorSelection selection, Throwable error) { public void onError(SelectorSelection selection, Throwable error) {
if (error instanceof IOException) { if (error instanceof IOException) {
onException((IOException) error); onException((IOException) error);
@ -154,12 +155,14 @@ public class AmqpNioTransport extends TcpTransport {
} }
} }
@Override
protected void doStart() throws Exception { protected void doStart() throws Exception {
connect(); connect();
selection.setInterestOps(SelectionKey.OP_READ); selection.setInterestOps(SelectionKey.OP_READ);
selection.enable(); selection.enable();
} }
@Override
protected void doStop(ServiceStopper stopper) throws Exception { protected void doStop(ServiceStopper stopper) throws Exception {
try { try {
if (selection != null) { if (selection != null) {

View File

@ -1151,7 +1151,6 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
if (response.isException()) { if (response.isException()) {
sender.setSource(null); sender.setSource(null);
Throwable exception = ((ExceptionResponse) response).getException(); Throwable exception = ((ExceptionResponse) response).getException();
String name = exception.getClass().getName();
sender.setCondition(new ErrorCondition(AmqpError.INTERNAL_ERROR, exception.getMessage())); sender.setCondition(new ErrorCondition(AmqpError.INTERNAL_ERROR, exception.getMessage()));
} }
sender.open(); sender.open();

View File

@ -16,11 +16,9 @@
*/ */
package org.apache.activemq.transport.amqp; package org.apache.activemq.transport.amqp;
import org.apache.activemq.command.Command;
import org.fusesource.hawtbuf.Buffer;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.activemq.command.Command;
/** /**
*/ */

View File

@ -82,7 +82,7 @@ public class AmqpTestSupport {
Future<Boolean> future = executor.submit(new SetUpTask()); Future<Boolean> future = executor.submit(new SetUpTask());
try { try {
LOG.debug("SetUpTask started."); LOG.debug("SetUpTask started.");
Boolean result = future.get(60, TimeUnit.SECONDS); future.get(60, TimeUnit.SECONDS);
} catch (TimeoutException e) { } catch (TimeoutException e) {
throw new Exception("startBroker timed out"); throw new Exception("startBroker timed out");
} }
@ -164,7 +164,7 @@ public class AmqpTestSupport {
Future<Boolean> future = executor.submit(new TearDownTask()); Future<Boolean> future = executor.submit(new TearDownTask());
try { try {
LOG.debug("tearDown started."); LOG.debug("tearDown started.");
Boolean result = future.get(60, TimeUnit.SECONDS); future.get(60, TimeUnit.SECONDS);
} catch (TimeoutException e) { } catch (TimeoutException e) {
throw new Exception("startBroker timed out"); throw new Exception("startBroker timed out");
} }
@ -247,6 +247,7 @@ public class AmqpTestSupport {
} }
public class SetUpTask implements Callable<Boolean> { public class SetUpTask implements Callable<Boolean> {
@SuppressWarnings("unused")
private String testName; private String testName;
@Override @Override
@ -259,6 +260,7 @@ public class AmqpTestSupport {
} }
public class TearDownTask implements Callable<Boolean> { public class TearDownTask implements Callable<Boolean> {
@SuppressWarnings("unused")
private String testName; private String testName;
@Override @Override
@ -269,5 +271,4 @@ public class AmqpTestSupport {
return Boolean.TRUE; return Boolean.TRUE;
} }
} }
} }

View File

@ -16,16 +16,9 @@
*/ */
package org.apache.activemq.transport.amqp; package org.apache.activemq.transport.amqp;
import javax.jms.JMSException;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
/** /**
* Test the JMS client when connected to the NIO transport. * Test the JMS client when connected to the NIO transport.
*/ */

View File

@ -24,7 +24,6 @@ import javax.net.ssl.TrustManager;
import org.apache.activemq.transport.amqp.DefaultTrustManager; import org.apache.activemq.transport.amqp.DefaultTrustManager;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.rules.Timeout; import org.junit.rules.Timeout;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@ -35,7 +35,6 @@ import org.objectweb.jtests.jms.conform.selector.SelectorSyntaxTest;
import org.objectweb.jtests.jms.conform.selector.SelectorTest; import org.objectweb.jtests.jms.conform.selector.SelectorTest;
import org.objectweb.jtests.jms.conform.session.QueueSessionTest; import org.objectweb.jtests.jms.conform.session.QueueSessionTest;
import org.objectweb.jtests.jms.conform.session.SessionTest; import org.objectweb.jtests.jms.conform.session.SessionTest;
import org.objectweb.jtests.jms.conform.session.UnifiedSessionTest;
import org.objectweb.jtests.jms.conform.topic.TemporaryTopicTest; import org.objectweb.jtests.jms.conform.topic.TemporaryTopicTest;
public class JoramJmsTest extends TestCase { public class JoramJmsTest extends TestCase {