Skip to content

Commit

Permalink
Merge pull request #40 from pferraro/1.2.x
Browse files Browse the repository at this point in the history
[1.2.x] Revise MODCLUSTER-332 fix.
  • Loading branch information
jfclere committed Aug 30, 2013
2 parents 13fc306 + 8809746 commit 87b0919
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ public int getDefaultPort() {
*
* @see java.lang.Enum#toString()
*/
@Override
public String toString() {
return this.name().toLowerCase();
}
};
}

/**
* Indicates whether the endpoint of this connector uses a reverse connection to httpd. A reverse connection uses a normal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,17 @@
*/
public class CatalinaEventHandlerAdapter implements CatalinaEventHandler {

private static final int STATUS_FREQUENCY = Integer.parseInt(System.getProperty("org.jboss.modcluster.container.catalina.status-frequency", "1"));

protected final ContainerEventHandler eventHandler;
protected final ServerProvider serverProvider;
protected final CatalinaFactory factory;

// Flags used to ignore redundant or invalid events
protected final AtomicBoolean init = new AtomicBoolean(false);
protected final AtomicBoolean start = new AtomicBoolean(false);

protected final int WAITSTATUS = Integer.parseInt(System.getProperty("org.jboss.modcluster.container.catalina.WAITSTATUS", "10"));
protected int waited = 0;
protected int interval = -1;

// ----------------------------------------------------------- Constructors
private volatile int statusCount = 0;

/**
* Constructs a new CatalinaEventHandlerAdapter using the specified event handler.
Expand Down Expand Up @@ -244,19 +242,13 @@ public void lifecycleEvent(LifecycleEvent event) {
}
} else if (type.equals(Lifecycle.PERIODIC_EVENT)) {
if (source instanceof Engine) {
if (interval==-1) {
Engine eng = (Engine) source;
interval = eng.getBackgroundProcessorDelay();
if (interval==0)
interval = 10;
}
waited = waited + interval;
if (waited>=WAITSTATUS || WAITSTATUS<=interval) {
waited = 0;
if (this.start.get()) {
this.eventHandler.status(this.factory.createEngine((Engine) source));
}
}
Engine engine = (Engine) source;
this.statusCount = (this.statusCount + 1) % STATUS_FREQUENCY;
if (this.statusCount == 0) {
if (this.start.get()) {
this.eventHandler.status(this.factory.createEngine(engine));
}
}
}
}
}
Expand Down

0 comments on commit 87b0919

Please sign in to comment.