import java.util.List;
import java.util.Date;
import org.opensrf.net.xmpp.XMPPException;
+import org.opensrf.util.Logger;
public class Request {
/** wait up to millis milliseconds for a result. waitForMessage()
* will return if a response to any request arrives, so we keep track
* of how long we've been waiting in total for a response to
- * this request
- */
+ * this request */
+
long start = new Date().getTime();
session.waitForMessage(millis);
millis -= new Date().getTime() - start;
}
private static void processOSRFMessage(Session ses, Message msg) throws MethodException {
+
+ Logger.debug("received id=" + msg.getId() +
+ " type=" + msg.getType() + " payload=" + msg.getPayload());
+
if( ses instanceof ClientSession )
processResponse((ClientSession) ses, msg);
else
import java.io.InputStream;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.Date;
+import org.opensrf.util.Logger;
import com.ctc.wstx.stax.WstxInputFactory;
msg.setBody(msgBody.toString());
msg.setThread(msgThread.toString());
+ Logger.internal("xmpp message from="+msgFrom+" " + msg.getBody());
+
msgQueue.offer(msg);
resetBuffers();
notifyCoreEvent();
public static final short WARN = 2;
public static final short INFO = 3;
public static final short DEBUG = 4;
+ public static final short INTERNAL = 5;
/** The global log instance */
private static Logger instance;
instance.log(DEBUG, msg);
}
+ /**
+ * Logs an internal message
+ * @param msg The message to log
+ */
+ public static void internal(String msg) {
+ instance.log(INTERNAL, msg);
+ }
+
+
/**
* Appends the text representation of the log level
* @param sb The stringbuffer to append to
sb.append("DEBG"); break;
case INFO:
sb.append("INFO"); break;
+ case INTERNAL:
+ sb.append("INT "); break;
case WARN:
sb.append("WARN"); break;
case ERROR:
sb.append(" [");
appendLevelString(sb, level);
+ sb.append(":");
+ sb.append(Thread.currentThread().getId());
sb.append("] ");
sb.append(msg);
return sb.toString();