User: chirino
Date: 01/07/15 19:51:45
Modified: src/main/org/jbossmq/cluster/transport/udp
UDPAdminStream.java UDPStream.java
UDPTransport.java
Log:
Moved the rest of JBossMQ over to log4j logging.
- The jbossmq-client.jar now includes a log4j.properties which sets up the logging
subsystems on the client side. To chanage the logging levels, just place your
log4j.properties in the classpath betfore the jbossmq-client.jar
Revision Changes Path
1.2 +5 -3
jbossmq/src/main/org/jbossmq/cluster/transport/udp/UDPAdminStream.java
Index: UDPAdminStream.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jbossmq/cluster/transport/udp/UDPAdminStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UDPAdminStream.java 2001/03/02 07:04:53 1.1
+++ UDPAdminStream.java 2001/07/16 02:51:45 1.2
@@ -14,8 +14,8 @@
import java.util.HashMap;
import java.util.Vector;
-import org.jbossmq.Log;
+
/**
* The UDPAdminStream class blocks on a UDP socket
* waiting for admin packets.
@@ -25,7 +25,7 @@
*
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
class UDPAdminStream implements Runnable {
@@ -88,7 +88,7 @@
// Is the packet ok?
if (packet.getLength() < Datagram.HEADER_SIZE)
{
- Log.notice("[" + this +"] Packet was
too small, dropping.");
+ cat.info("[" + this +"] Packet was too
small, dropping.");
continue;
}
@@ -143,4 +143,6 @@
public String toString() {
return "org.jbossmq.cluster.udp.UDPAdminStream";
}
+
+ static org.apache.log4j.Category cat =
org.apache.log4j.Category.getInstance(UDPAdminStream.class);
}
1.2 +7 -5
jbossmq/src/main/org/jbossmq/cluster/transport/udp/UDPStream.java
Index: UDPStream.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jbossmq/cluster/transport/udp/UDPStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UDPStream.java 2001/03/02 07:04:54 1.1
+++ UDPStream.java 2001/07/16 02:51:45 1.2
@@ -14,9 +14,9 @@
import java.util.HashMap;
import java.util.Vector;
-import org.jbossmq.Log;
+
/**
* The UDPStream class blocks on a UDP socket
* waiting for input. Since a message is made up
@@ -40,7 +40,7 @@
*
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
class UDPStream implements Runnable {
@@ -155,7 +155,7 @@
// TODO: make it also happen when a message sits too long on
// the stream.
private void handleNodeUnresponsive(NodeState nodeState) {
- Log.error("NODE IS UNRESPONSIVE!!!");
+ cat.error("NODE IS UNRESPONSIVE!!!");
}
/**
@@ -216,7 +216,7 @@
// Is the packet ok?
if (packet.getLength() < Datagram.HEADER_SIZE)
{
- Log.notice("["+this+"] Packet was too
small, dropping.");
+ cat.info("["+this+"] Packet was too
small, dropping.");
continue;
}
@@ -326,7 +326,7 @@
UDPNodeId senderId = dg.getSenderId();
int id = dg.getId();
short fragmentId = dg.getFragmentId();
- Log.log("["+this+"] Processing datagram: " + id);
+ cat.debug("["+this+"] Processing datagram: " + id);
NodeState nodeState = getNodeState(senderId);
MessageState ds = getMessageState(nodeState, id);
@@ -443,4 +443,6 @@
public String toString() {
return "org.jbossmq.cluster.udp.UDPStream:"+name;
}
+
+ static org.apache.log4j.Category cat =
org.apache.log4j.Category.getInstance(UDPStream.class);
}
1.2 +16 -14
jbossmq/src/main/org/jbossmq/cluster/transport/udp/UDPTransport.java
Index: UDPTransport.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jbossmq/cluster/transport/udp/UDPTransport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UDPTransport.java 2001/03/02 07:04:54 1.1
+++ UDPTransport.java 2001/07/16 02:51:45 1.2
@@ -21,7 +21,7 @@
import java.io.Externalizable;
import java.io.ObjectInputStream;
-import org.jbossmq.Log;
+
import org.jbossmq.cluster.transport.InvalidConfigurationException;
import org.jbossmq.cluster.transport.Transport;
import org.jbossmq.cluster.transport.NodeId;
@@ -45,7 +45,7 @@
*
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class UDPTransport implements Transport {
@@ -150,14 +150,14 @@
data.length);
dg.setId(adminStream.getNextDatagramId());
- Log.log("[" + this +"] Sending admin datagram: " + dg.getId());
+ cat.debug("[" + this +"] Sending admin datagram: " + dg.getId());
DatagramPacket packet = new java.net.DatagramPacket(dg.data,
dg.data.length, dest.address, dest.adminPort);
adminStream.socket.send(packet);
}
void datagramArrived(Datagram dg) throws InterruptedException {
- Log.log("[" + this +"] A datagram arrived");
+ cat.debug("[" + this +"] A datagram arrived");
if (dg.isMessageFlagsSet(Datagram.ADMIN_FLAG)) {
try {
@@ -172,13 +172,13 @@
ResendAdminDatagram radg =
(ResendAdminDatagram) o;
for (int i = 0; i < radg.datagramIds.length;
i++) {
- Log.log("[" + this +"] RESEND REQUEST
ARRIVED: " + radg.datagramIds[i]);
+ cat.debug("[" + this +"] RESEND
REQUEST ARRIVED: " + radg.datagramIds[i]);
resendDatagram(dg.getSenderId(),
radg.datagramIds[i], radg.broadcast);
}
} else if (o instanceof ResendErrorAdminDatagram) {
ResendErrorAdminDatagram readg =
(ResendErrorAdminDatagram) o;
- Log.log("[" + this +"] RESEND REQUEST FAILED:
" + readg.datagramId);
+ cat.debug("[" + this +"] RESEND REQUEST
FAILED: " + readg.datagramId);
if (readg.broadcast) {
broadcastStream.removeFromDatagramStream(dg.getSenderId(), readg.datagramId);
} else {
@@ -226,20 +226,20 @@
if (broadcast) {
Datagram dg = broadcastStream.getFromSentCache(messageId);
if (dg != null) {
- Log.log("[" + this +"] BROADCAST RESEND REQUEST
SERVICED: " + messageId);
+ cat.debug("[" + this +"] BROADCAST RESEND REQUEST
SERVICED: " + messageId);
send(dg, false);
return;
} else {
- Log.log("[" + this +"] BROADCAST RESEND REQUEST NOT
SERVICED (not in cache): " + messageId);
+ cat.debug("[" + this +"] BROADCAST RESEND REQUEST NOT
SERVICED (not in cache): " + messageId);
}
} else {
Datagram dg = pointStream.getFromSentCache(messageId);
if (dg != null) {
- Log.log("[" + this +"] POINT RESEND REQUEST SERVICED:
" + messageId);
+ cat.debug("[" + this +"] POINT RESEND REQUEST
SERVICED: " + messageId);
send(requestor, dg, false);
return;
} else {
- Log.log("[" + this +"] POINT RESEND REQUEST NOT
SERVICED (not in cache): " + messageId);
+ cat.debug("[" + this +"] POINT RESEND REQUEST NOT
SERVICED (not in cache): " + messageId);
}
}
@@ -274,7 +274,7 @@
broadcastStream.addToSentCache(dg);
// Send the fragment chain.
- Log.log("[" + this +"] Sending Broadcast datagram: " + dg.getId());
+ cat.debug("[" + this +"] Sending Broadcast datagram: " + dg.getId());
while (dg != null) {
if (setDatagramId)
@@ -297,7 +297,7 @@
pointStream.addToSentCache(dg);
- Log.log("[" + this +"] Sending Point datagram: " + dg.getId());
+ cat.debug("[" + this +"] Sending Point datagram: " + dg.getId());
// Send the fragment chain.
while (dg != null) {
if (setDatagramId)
@@ -318,7 +318,7 @@
msgs[i] = ((Integer) messageIds.elementAt(i)).intValue();
}
- Log.log("[" + this +"] SENDING RESEND REQUEST: " + messageIds);
+ cat.debug("[" + this +"] SENDING RESEND REQUEST: " + messageIds);
ResendAdminDatagram m = new ResendAdminDatagram(msgs, broadcast);
try {
adminSend(nodeId, m);
@@ -448,7 +448,7 @@
adminSocket = new DatagramSocket();
nodeId.adminPort = adminSocket.getLocalPort();
- Log.log("[" + this +"] Local NodeId: " + nodeId);
+ cat.debug("[" + this +"] Local NodeId: " + nodeId);
clusterId.address = group;
clusterId.port = port;
@@ -468,4 +468,6 @@
public void setTransportListener(TransportListener c) {
transportListener = c;
}
+
+ static org.apache.log4j.Category cat =
org.apache.log4j.Category.getInstance(UDPTransport.class);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development