This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 73385 - Review JBoss 4 plugin code
Summary: Review JBoss 4 plugin code
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: JBoss (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Libor Kotouc
URL:
Keywords:
: 76237 (view as bug list)
Depends on:
Blocks: 71589
  Show dependency tree
 
Reported: 2006-03-08 14:24 UTC by Jiri Sedlacek
Modified: 2006-05-24 12:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Sedlacek 2006-03-08 14:24:45 UTC
When implementing Profiling API into JBoss 4 plugin, I've seen several problems 
in the plugin code, that may be bugs or at least "strange" way of doing things. 
It would be good to review the code thoroughly for correctness.

Problematic parts I've found:

1/ When redirecting server output/log to IDE log window, the JBLogWriter (and 
also code in JBStartServer responsible for logging server startup) has 
hardcoded 500ms delay before logging each line, which I don't fully understand 
why. As a result, when stopping the server (JBStartServer.JBStopRunnable.run()) 
there is 30sec delay after the server has stopped - seems like the reason is to 
lazily get all the log output to IDE log window.

2/ The JBLogWriter runs in separate thread and seems to be never stopped 
explicitely. This works fine for normal usage, but makes problems when in 
profiling mode. There are at least two places where logging of the server is 
started - JBStartServer.JBStartRunnable.run() and JBStartServer.isRunning(). 
When in profiling mode, the logger is started from JBStartServer.isRunning() 
method and seems to never stop, blocking logging for subsequent starts in 
profiling mode. The only solution I've found is to explicitely stop running 
logger when server is stopped from JBStartServer.JBStopRunnable.run(). This 
leads to a question if overall JBoss logging architecture is designed and 
working correctly.

3/ Similar to 2/, it seems to me that in JBLogWriter.updateInstance() the 
logger should be stopped first if running before removing from instances cache.

4/ (Code readability) in JBLogWriter "if(line.indexOf("INFO")<0) continue;" 
condition is used several times, which looks quite ugly.
Comment 1 Libor Kotouc 2006-04-28 15:14:32 UTC
Fixed.

ad 1/ the 500 ms delay is for the situation when there is no server input.
accidentally, the condition checking whether there is some input was checked
only once instead of a cyclic checking

This lead to the unnecessary delaying of the longer message sequences like in
the issue 71589.

ad 2/ the log writer was never stopped. Now it is stopped explicitelly when the
server is being stopped. Another pending log writer stopping is done when the
server starts in the profiling mode, maybe it is not necessary now.

ad 3/ updateInstance no longer exists

ad 4/ 'INFO' statements were wrong. Even if not the file reading was removed.

cvs server: scheduling file `ide/JBStartRunnable.java' for addition on branch
`release55'
cvs server: scheduling file `ide/JBStopRunnable.java' for addition on branch
`release55'
cvs server: scheduling file `nodes/actions/OpenServerLogAction.java' for
addition on branch `release55'
cvs server: use 'cvs commit' to add these files permanently
RCS file:
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/nodes/actions/Attic/OpenServerLogAction.java,v
done
Checking in nodes/actions/OpenServerLogAction.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/nodes/actions/Attic/OpenServerLogAction.java,v
 <--  OpenServerLogAction.java
new revision: 1.1.2.1; previous revision: 1.1
done
Checking in nodes/actions/Bundle.properties;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/nodes/actions/Attic/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.1.2.6; previous revision: 1.1.2.5
done
Checking in ide/JBLogWriter.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBLogWriter.java,v
 <--  JBLogWriter.java
new revision: 1.3.42.3; previous revision: 1.3.42.2
done
RCS file:
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/Attic/JBStopRunnable.java,v
done
Checking in ide/JBStopRunnable.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/Attic/JBStopRunnable.java,v
 <--  JBStopRunnable.java
new revision: 1.1.2.1; previous revision: 1.1
done
RCS file:
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/Attic/JBStartRunnable.java,v
done
Checking in ide/JBStartRunnable.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/Attic/JBStartRunnable.java,v
 <--  JBStartRunnable.java
new revision: 1.1.2.1; previous revision: 1.1
done
Checking in ide/JBStartServer.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java,v
 <--  JBStartServer.java
new revision: 1.17.8.5.2.8; previous revision: 1.17.8.5.2.7
done
Checking in JBDeploymentManager.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentManager.java,v
 <--  JBDeploymentManager.java
new revision: 1.6.8.4.2.5; previous revision: 1.6.8.4.2.4
done
Checking in nodes/JBManagerNode.java;
/cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/nodes/JBManagerNode.java,v
 <--  JBManagerNode.java
new revision: 1.4.12.2.2.6; previous revision: 1.4.12.2.2.5
done
Comment 2 Libor Kotouc 2006-05-12 08:53:41 UTC
*** Issue 76237 has been marked as a duplicate of this issue. ***
Comment 3 Michal Mocnak 2006-05-24 12:00:16 UTC
Verified