You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by co...@apache.org on 2003/02/20 06:52:00 UTC
cvs commit: jakarta-commons/modeler/src/java/org/apache/commons/modeler BaseNotification.java
costin 2003/02/19 21:52:00
Modified: modeler/src/java/org/apache/commons/modeler
BaseNotification.java
Log:
Some work on the base notification.
The goal is to make it recyclable and support "notes" ( i.e. int-based array accessors
to attributes - like "handles" or descriptors), that would make the jmx notification
a good replacement for the current callbacks in coyote and jk ( and anything else ).
This is not yet complete - we also need an mbean to act as an "Id manager" and
maintain the int ids.
Revision Changes Path
1.2 +30 -16 jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseNotification.java
Index: BaseNotification.java
===================================================================
RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseNotification.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseNotification.java 15 Jan 2003 00:34:05 -0000 1.1
+++ BaseNotification.java 20 Feb 2003 05:52:00 -0000 1.2
@@ -70,7 +70,11 @@
public final class BaseNotification extends Notification {
// ----------------------------------------------------------- Constructors
- int code;
+ private int code;
+ private String type;
+ private Object source;
+ private long seq;
+ private long tstamp;
/**
* Private constructor.
@@ -81,17 +85,40 @@
long tstamp,
int code) {
super(type, source, seq, tstamp);
+ init( type, source, seq, tstamp, code );
this.code=code;
}
+ public void recycle() {
+
+ }
+
+ public void init( String type, Object source,
+ long seq, long tstamp, int code )
+ {
+ this.type=type;
+ this.source = source;
+ this.seq=seq;
+ this.tstamp=tstamp;
+ this.code = code;
+ }
+
+ // -------------------- Override base methods --------------------
+ // All base methods need to be overriden - in order to support recycling.
+
+
+ // -------------------- Information associated with the notification ----
+ // Like events ( which Notification extends ), notifications may store
+ // informations related with the event that trigered it. Source and type is
+ // one piece, but it is common to store more info.
+
/** Action id, useable in switches and table indexes
*/
public int getCode() {
return code;
}
- static int noteId[]=new int[4];
- static String noteName[][]=new String[4][];
+ // XXX Make it customizable - or grow it
private Object notes[]=new Object[32];
public final Object getNote(int i ) {
@@ -101,17 +128,4 @@
public final void setNote(int i, Object o ) {
notes[i]=o;
}
-
- /** @deprecated JNDI should be used instead
- */
- public static int getNoteId( int type, String name ) {
- for( int i=0; i<noteId[type]; i++ ) {
- if( name.equals( noteName[type][i] ))
- return i;
- }
- int id=noteId[type]++;
- noteName[type][id]=name;
- return id;
- }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org