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.TextMessage;
import javax.jms.Topic;
import org.apache.activemq.command.ActiveMQBytesMessage;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMapMessage;
@ -80,11 +81,11 @@ public class ActiveMQJMSVendor extends JMSVendor {
}
@Override
@SuppressWarnings("deprecation")
public Destination createDestination(String name) {
return super.createDestination(name, Destination.class);
}
@Override
public <T extends Destination> T createDestination(String name, Class<T> kind) {
if( kind == Queue.class ) {
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.wireformat.WireFormat;
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
*/
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 SocketChannel channel;
@ -61,17 +59,20 @@ public class AmqpNioTransport extends TcpTransport {
super(wireFormat, socket);
}
@Override
protected void initializeStreams() throws IOException {
channel = socket.getChannel();
channel.configureBlocking(false);
// listen for events telling us when the socket is readable.
selection = SelectorManager.getInstance().register(channel, new SelectorManager.Listener() {
@Override
public void onSelect(SelectorSelection selection) {
if (!isStopped()) {
serviceRead();
}
}
@Override
public void onError(SelectorSelection selection, Throwable error) {
if (error instanceof IOException) {
onException((IOException) error);
@ -154,12 +155,14 @@ public class AmqpNioTransport extends TcpTransport {
}
}
@Override
protected void doStart() throws Exception {
connect();
selection.setInterestOps(SelectionKey.OP_READ);
selection.enable();
}
@Override
protected void doStop(ServiceStopper stopper) throws Exception {
try {
if (selection != null) {

View File

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

View File

@ -16,11 +16,9 @@
*/
package org.apache.activemq.transport.amqp;
import org.apache.activemq.command.Command;
import org.fusesource.hawtbuf.Buffer;
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());
try {
LOG.debug("SetUpTask started.");
Boolean result = future.get(60, TimeUnit.SECONDS);
future.get(60, TimeUnit.SECONDS);
} catch (TimeoutException e) {
throw new Exception("startBroker timed out");
}
@ -164,7 +164,7 @@ public class AmqpTestSupport {
Future<Boolean> future = executor.submit(new TearDownTask());
try {
LOG.debug("tearDown started.");
Boolean result = future.get(60, TimeUnit.SECONDS);
future.get(60, TimeUnit.SECONDS);
} catch (TimeoutException e) {
throw new Exception("startBroker timed out");
}
@ -247,6 +247,7 @@ public class AmqpTestSupport {
}
public class SetUpTask implements Callable<Boolean> {
@SuppressWarnings("unused")
private String testName;
@Override
@ -259,6 +260,7 @@ public class AmqpTestSupport {
}
public class TearDownTask implements Callable<Boolean> {
@SuppressWarnings("unused")
private String testName;
@Override
@ -269,5 +271,4 @@ public class AmqpTestSupport {
return Boolean.TRUE;
}
}
}

View File

@ -16,16 +16,9 @@
*/
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.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
/**
* 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.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.rules.Timeout;
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.session.QueueSessionTest;
import org.objectweb.jtests.jms.conform.session.SessionTest;
import org.objectweb.jtests.jms.conform.session.UnifiedSessionTest;
import org.objectweb.jtests.jms.conform.topic.TemporaryTopicTest;
public class JoramJmsTest extends TestCase {