Preparing 4.0 release

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/tags/activemq-4.0/activemq@405238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-05-09 00:02:31 +00:00
commit 85357053f0
6 changed files with 57 additions and 32 deletions

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.activemq.Service;
import org.apache.activemq.broker.region.ConnectionStatistics;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.BrokerInfo;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.ConnectionControl;
@ -372,7 +371,7 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
ConnectionState cs = lookupConnectionState(info.getConnectionId());
broker.addDestinationInfo(cs.getContext(), info);
if( info.getDestination().isTemporary() ) {
cs.addTempDestination(info.getDestination());
cs.addTempDestination(info);
}
return null;
}
@ -532,11 +531,11 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
// Cascade the connection stop to temp destinations.
for (Iterator iter = cs.getTempDesinations().iterator(); iter.hasNext();) {
ActiveMQDestination dest = (ActiveMQDestination) iter.next();
DestinationInfo di = (DestinationInfo) iter.next();
try{
broker.removeDestination(cs.getContext(), dest, 0);
broker.removeDestination(cs.getContext(), di.getDestination(), 0);
}catch(Throwable e){
serviceLog.warn("Failed to remove tmp destination " + dest,e);
serviceLog.warn("Failed to remove tmp destination " + di.getDestination(), e);
}
iter.remove();
}

View File

@ -130,7 +130,11 @@ public class PartialCommand implements Command {
}
public String toString() {
return "PartialCommand[id: " + commandId + " data: " + data.length + " byte(s)]";
int size = 0;
if (data != null) {
size = data.length;
}
return "PartialCommand[id: " + commandId + " data: " + size + " byte(s)]";
}

View File

@ -20,11 +20,13 @@ package org.apache.activemq.state;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.command.DestinationInfo;
import org.apache.activemq.command.SessionId;
import org.apache.activemq.command.SessionInfo;
@ -46,12 +48,17 @@ public class ConnectionState {
return info.toString();
}
public void addTempDestination(ActiveMQDestination destination) {
tempDestinations.add(destination);
public void addTempDestination(DestinationInfo info) {
tempDestinations.add(info);
}
public void removeTempDestination(ActiveMQDestination destination) {
tempDestinations.remove(destination);
for (Iterator iter = tempDestinations.iterator(); iter.hasNext();) {
DestinationInfo di = (DestinationInfo) iter.next();
if( di.getDestination().equals(destination) ) {
iter.remove();
}
}
}
public void addSession(SessionInfo info) {

View File

@ -147,7 +147,7 @@ public class ConnectionStateTracker implements CommandVisitor {
public Response processAddDestination(DestinationInfo info) throws Exception {
ConnectionState cs = (ConnectionState) connectionStates.get(info.getConnectionId());
if( info.getDestination().isTemporary() ) {
cs.addTempDestination(info.getDestination());
cs.addTempDestination(info);
}
return TRACKED_RESPONSE_MARKER;
}

View File

@ -34,15 +34,20 @@ class CommandParser {
}
Command parse(DataInput in) throws IOException, JMSException {
String line;
String line = null;
// skip white space to next real line
try {
while ((line = in.readLine()).trim().length() == 0) {
while (true) {
line = in.readLine();
if (line == null) {
throw new IOException("connection was closed");
}
else {
line = line.trim();
if (line.length() > 0) {
break;
}
}
}
catch (NullPointerException e) {
throw new IOException("connection was closed");
}
// figure correct command and return it

View File

@ -32,28 +32,38 @@ class HeaderParser {
*/
Properties parse(BufferedReader in) throws IOException {
Properties props = new Properties();
String line;
while (((line = in.readLine()).trim().length() > 0)) {
int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
String name = line.substring(0, seperator_index).trim();
String value = line.substring(seperator_index + 1, line.length()).trim();
props.setProperty(name, value);
while (true) {
String line = in.readLine();
if (line != null && line.trim().length() > 0) {
int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
String name = line.substring(0, seperator_index).trim();
String value = line.substring(seperator_index + 1, line.length()).trim();
props.setProperty(name, value);
}
else {
break;
}
}
return props;
}
Properties parse(DataInput in) throws IOException {
Properties props = new Properties();
String line;
while (((line = in.readLine()).trim().length() > 0)) {
try {
int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
String name = line.substring(0, seperator_index).trim();
String value = line.substring(seperator_index + 1, line.length()).trim();
props.setProperty(name, value);
while (true) {
String line = in.readLine();
if (line != null && line.trim().length() > 0) {
try {
int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
String name = line.substring(0, seperator_index).trim();
String value = line.substring(seperator_index + 1, line.length()).trim();
props.setProperty(name, value);
}
catch (Exception e) {
throw new ProtocolException("Unable to parser header line [" + line + "]");
}
}
catch (Exception e) {
throw new ProtocolException("Unable to parser header line [" + line + "]");
else {
break;
}
}
return props;