* @param ex The current exception
*/
private void handleException(Exception ex)
- throws Throwable {
+ throws Throwable {
Throwable realException;
@Override
public String getParameter(String name) {
- parseParameters();
+ parseParameters();
Object value = parameters.get(name);
if (value == null)
@Override
public Map<String, String[]> getParameterMap() {
- parseParameters();
+ parseParameters();
return (parameters);
}
@Override
public Enumeration<String> getParameterNames() {
- parseParameters();
+ parseParameters();
return (new Enumerator<String>(parameters.keySet()));
}
@Override
public String[] getParameterValues(String name) {
- parseParameters();
+ parseParameters();
Object value = parameters.get(name);
if (value == null)
return null;
*/
void parseParameters() {
- if (parsedParams) {
- return;
- }
+ if (parsedParams) {
+ return;
+ }
parameters = new HashMap<String, String[]>();
parameters = copyMap(getRequest().getParameterMap());
}
public void newInstance(Object o)
- throws IllegalAccessException, InvocationTargetException, NamingException {
- newInstance(o, o.getClass());
+ throws IllegalAccessException, InvocationTargetException, NamingException {
+ newInstance(o, o.getClass());
}
private Object newInstance(Object instance, Class<?> clazz) throws IllegalAccessException, InvocationTargetException, NamingException {
if (isUseNaming() && namingContextListener != null) {
context = namingContextListener.getEnvContext();
}
- Map<String, Map<String, String>> injectionMap =
- buildInjectionMap(getIgnoreAnnotations() ? new NamingResources(): getNamingResources());
- instanceManager = new DefaultInstanceManager
- (context, injectionMap, this, this.getClass().getClassLoader());
+ Map<String, Map<String, String>> injectionMap = buildInjectionMap(
+ getIgnoreAnnotations() ? new NamingResources(): getNamingResources());
+ instanceManager = new DefaultInstanceManager(
+ context, injectionMap, this, this.getClass().getClassLoader());
getServletContext().setAttribute(InstanceManager.class.getName(), instanceManager);
}
}
*/
public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter, Object object) throws ListenerNotFoundException {
- broadcaster.removeNotificationListener(listener,filter,object);
-
+ broadcaster.removeNotificationListener(listener,filter,object);
}
private MBeanNotificationInfo[] notificationInfo;
* @see javax.management.NotificationBroadcaster#getNotificationInfo()
*/
public MBeanNotificationInfo[] getNotificationInfo() {
- // FIXME: i18n
- if(notificationInfo == null) {
- notificationInfo = new MBeanNotificationInfo[]{
- new MBeanNotificationInfo(new String[] {
- "j2ee.object.created"},
- Notification.class.getName(),
- "web application is created"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.state.starting"},
- Notification.class.getName(),
- "change web application is starting"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.state.running"},
- Notification.class.getName(),
- "web application is running"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.state.stopping"},
- Notification.class.getName(),
- "web application start to stopped"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.object.stopped"},
- Notification.class.getName(),
- "web application is stopped"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.object.deleted"},
- Notification.class.getName(),
- "web application is deleted"
- )
- };
-
- }
-
- return notificationInfo;
+ // FIXME: i18n
+ if(notificationInfo == null) {
+ notificationInfo = new MBeanNotificationInfo[]{
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.object.created"},
+ Notification.class.getName(),
+ "web application is created"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.state.starting"},
+ Notification.class.getName(),
+ "change web application is starting"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.state.running"},
+ Notification.class.getName(),
+ "web application is running"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.state.stopping"},
+ Notification.class.getName(),
+ "web application start to stopped"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.object.stopped"},
+ Notification.class.getName(),
+ "web application is stopped"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.object.deleted"},
+ Notification.class.getName(),
+ "web application is deleted"
+ )
+ };
+
+ }
+
+ return notificationInfo;
}
*/
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter, Object object) throws IllegalArgumentException {
- broadcaster.addNotificationListener(listener,filter,object);
-
+ broadcaster.addNotificationListener(listener,filter,object);
}
*/
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
- broadcaster.removeNotificationListener(listener);
-
+ broadcaster.removeNotificationListener(listener);
}
* @param newProcessTlds The new value
*/
public void setProcessTlds(boolean newProcessTlds) {
- processTlds = newProcessTlds;
+ processTlds = newProcessTlds;
}
/**
* Returns the processTlds attribute value.
*/
public boolean getProcessTlds() {
- return processTlds;
+ return processTlds;
}
/**
break;
}
}
- if(!found) {
+ if(!found) {
Valve valve = (Valve) Class.forName(errorReportValveClass).
newInstance();
getPipeline().addValve(valve);
// Start the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
- current = basic;
+ current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).start();
- current = current.getNext();
+ current = current.getNext();
}
setState(LifecycleState.STARTING);
// Stop the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
- current = basic;
+ current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).stop();
- current = current.getNext();
+ current = current.getNext();
}
}
// Update the pipeline
Valve current = first;
while (current != null) {
- if (current.getNext() == oldBasic) {
- current.setNext(valve);
- break;
- }
- current = current.getNext();
+ if (current.getNext() == oldBasic) {
+ current.setNext(valve);
+ break;
+ }
+ current = current.getNext();
}
this.basic = valve;
// Add this Valve to the set associated with this Pipeline
if (first == null) {
- first = valve;
- valve.setNext(basic);
+ first = valve;
+ valve.setNext(basic);
} else {
Valve current = first;
while (current != null) {
- if (current.getNext() == basic) {
- current.setNext(valve);
- valve.setNext(basic);
- break;
- }
- current = current.getNext();
- }
+ if (current.getNext() == basic) {
+ current.setNext(valve);
+ valve.setNext(basic);
+ break;
+ }
+ current = current.getNext();
+ }
}
container.fireContainerEvent(Container.ADD_VALVE_EVENT, valve);
*/
public Valve[] getValves() {
- ArrayList<Valve> valveList = new ArrayList<Valve>();
+ ArrayList<Valve> valveList = new ArrayList<Valve>();
Valve current = first;
if (current == null) {
- current = basic;
+ current = basic;
}
while (current != null) {
- valveList.add(current);
- current = current.getNext();
+ valveList.add(current);
+ current = current.getNext();
}
return valveList.toArray(new Valve[0]);
public ObjectName[] getValveObjectNames() {
- ArrayList<ObjectName> valveList = new ArrayList<ObjectName>();
+ ArrayList<ObjectName> valveList = new ArrayList<ObjectName>();
Valve current = first;
if (current == null) {
- current = basic;
+ current = basic;
}
while (current != null) {
- if (current instanceof ValveBase) {
- valveList.add(((ValveBase) current).getObjectName());
- }
- current = current.getNext();
+ if (current instanceof ValveBase) {
+ valveList.add(((ValveBase) current).getObjectName());
+ }
+ current = current.getNext();
}
return valveList.toArray(new ObjectName[0]);
HashSet<String> allow = new HashSet<String>();
allow.add("TRACE");
allow.add("OPTIONS");
-
+
Method[] methods = getAllDeclaredMethods(servletClazz);
for (int i=0; methods != null && i<methods.length; i++) {
Method m = methods[i];
-
+
if (m.getName().equals("doGet")) {
allow.add("GET");
allow.add("HEAD");
if ((parentMethods != null) && (parentMethods.length > 0)) {
Method[] allMethods =
new Method[parentMethods.length + thisMethods.length];
- System.arraycopy(parentMethods, 0, allMethods, 0,
+ System.arraycopy(parentMethods, 0, allMethods, 0,
parentMethods.length);
- System.arraycopy(thisMethods, 0, allMethods, parentMethods.length,
+ System.arraycopy(thisMethods, 0, allMethods, parentMethods.length,
thisMethods.length);
- thisMethods = allMethods;
- }
+ thisMethods = allMethods;
+ }
- return thisMethods;
+ return thisMethods;
}
* @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
*/
public void removeNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object object) throws ListenerNotFoundException {
- broadcaster.removeNotificationListener(listener,filter,object);
-
+ NotificationFilter filter, Object object) throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener,filter,object);
}
protected MBeanNotificationInfo[] notificationInfo;
* @see javax.management.NotificationBroadcaster#getNotificationInfo()
*/
public MBeanNotificationInfo[] getNotificationInfo() {
-
- if(notificationInfo == null) {
- notificationInfo = new MBeanNotificationInfo[]{
- new MBeanNotificationInfo(new String[] {
- "j2ee.object.created"},
- Notification.class.getName(),
- "servlet is created"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.state.starting"},
- Notification.class.getName(),
- "servlet is starting"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.state.running"},
- Notification.class.getName(),
- "servlet is running"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.state.stopped"},
- Notification.class.getName(),
- "servlet start to stopped"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.object.stopped"},
- Notification.class.getName(),
- "servlet is stopped"
- ),
- new MBeanNotificationInfo(new String[] {
- "j2ee.object.deleted"},
- Notification.class.getName(),
- "servlet is deleted"
- )
- };
-
- }
-
- return notificationInfo;
+
+ if(notificationInfo == null) {
+ notificationInfo = new MBeanNotificationInfo[]{
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.object.created"},
+ Notification.class.getName(),
+ "servlet is created"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.state.starting"},
+ Notification.class.getName(),
+ "servlet is starting"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.state.running"},
+ Notification.class.getName(),
+ "servlet is running"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.state.stopped"},
+ Notification.class.getName(),
+ "servlet start to stopped"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.object.stopped"},
+ Notification.class.getName(),
+ "servlet is stopped"
+ ),
+ new MBeanNotificationInfo(new String[] {
+ "j2ee.object.deleted"},
+ Notification.class.getName(),
+ "servlet is deleted"
+ )
+ };
+ }
+
+ return notificationInfo;
}
*/
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter, Object object) throws IllegalArgumentException {
- broadcaster.addNotificationListener(listener,filter,object);
+ broadcaster.addNotificationListener(listener,filter,object);
}
*/
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
- broadcaster.removeNotificationListener(listener);
+ broadcaster.removeNotificationListener(listener);
}
// Check for the application being marked unavailable
if (!context.getAvailable()) {
- response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
+ response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
sm.getString("standardContext.isUnavailable"));
unavailable = true;
}
wrapper.getName()), e);
long available = wrapper.getAvailable();
if ((available > 0L) && (available < Long.MAX_VALUE)) {
- response.setDateHeader("Retry-After", available);
- response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
+ response.setDateHeader("Retry-After", available);
+ response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
sm.getString("standardWrapper.isUnavailable",
wrapper.getName()));
} else if (available == Long.MAX_VALUE) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
+ response.sendError(HttpServletResponse.SC_NOT_FOUND,
sm.getString("standardWrapper.notFound",
wrapper.getName()));
}
try {
response.sendAcknowledgement();
} catch (IOException e) {
- request.removeAttribute(Globals.JSP_FILE_ATTR);
+ request.removeAttribute(Globals.JSP_FILE_ATTR);
container.getLogger().warn(sm.getString("standardWrapper.acknowledgeException",
wrapper.getName()), e);
throwable = e;
try {
String jspFile = wrapper.getJspFile();
if (jspFile != null)
- request.setAttribute(Globals.JSP_FILE_ATTR, jspFile);
+ request.setAttribute(Globals.JSP_FILE_ATTR, jspFile);
else
- request.removeAttribute(Globals.JSP_FILE_ATTR);
+ request.removeAttribute(Globals.JSP_FILE_ATTR);
if ((servlet != null) && (filterChain != null)) {
// Swallow output if needed
if (context.getSwallowOutput()) {
}
request.removeAttribute(Globals.JSP_FILE_ATTR);
} catch (ClientAbortException e) {
- request.removeAttribute(Globals.JSP_FILE_ATTR);
+ request.removeAttribute(Globals.JSP_FILE_ATTR);
throwable = e;
exception(request, response, e);
} catch (IOException e) {
- request.removeAttribute(Globals.JSP_FILE_ATTR);
+ request.removeAttribute(Globals.JSP_FILE_ATTR);
container.getLogger().error(sm.getString(
"standardWrapper.serviceException", wrapper.getName(),
context.getName()), e);
throwable = e;
exception(request, response, e);
} catch (UnavailableException e) {
- request.removeAttribute(Globals.JSP_FILE_ATTR);
+ request.removeAttribute(Globals.JSP_FILE_ATTR);
container.getLogger().error(sm.getString(
"standardWrapper.serviceException", wrapper.getName(),
context.getName()), e);
sm.getString("standardWrapper.isUnavailable",
wrapper.getName()));
} else if (available == Long.MAX_VALUE) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
+ response.sendError(HttpServletResponse.SC_NOT_FOUND,
sm.getString("standardWrapper.notFound",
wrapper.getName()));
}
// Do not save exception in 'throwable', because we
// do not want to do exception(request, response, e) processing
} catch (ServletException e) {
- request.removeAttribute(Globals.JSP_FILE_ATTR);
+ request.removeAttribute(Globals.JSP_FILE_ATTR);
Throwable rootCause = StandardWrapper.getRootCause(e);
if (!(rootCause instanceof ClientAbortException)) {
container.getLogger().error(sm.getString(
*/
private void exception(Request request, Response response,
Throwable exception) {
- request.setAttribute(Globals.EXCEPTION_ATTR, exception);
+ request.setAttribute(Globals.EXCEPTION_ATTR, exception);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
*/
@Override
public void endAccess() {
- super.endAccess() ;
- if(manager instanceof DeltaManager) {
- ((DeltaManager)manager).registerSessionAtReplicationValve(this);
- }
+ super.endAccess() ;
+ if(manager instanceof DeltaManager) {
+ ((DeltaManager)manager).registerSessionAtReplicationValve(this);
+ }
}
// ------------------------------------------------- Session Public Methods
*/
public class SessionIDMessage extends ClusterMessageBase {
- private int messageNumber;
+ private int messageNumber;
- private String orignalSessionID;
+ private String orignalSessionID;
- private String backupSessionID;
+ private String backupSessionID;
- private String host ;
- private String contextPath;
+ private String host ;
+ private String contextPath;
- @Override
+ @Override
public String getUniqueId() {
- StringBuilder result = new StringBuilder(getOrignalSessionID());
- result.append("#-#");
- result.append(getHost());
+ StringBuilder result = new StringBuilder(getOrignalSessionID());
+ result.append("#-#");
+ result.append(getHost());
result.append("#-#");
result.append(getContextPath());
- result.append("#-#");
- result.append(getMessageNumber());
- result.append("#-#");
- result.append(System.currentTimeMillis());
- return result.toString();
- }
+ result.append("#-#");
+ result.append(getMessageNumber());
+ result.append("#-#");
+ result.append(System.currentTimeMillis());
+ return result.toString();
+ }
/**
* @return Returns the host.
this.host = host;
}
- /**
- * @return Returns the contextPath.
- */
- public String getContextPath() {
- return contextPath;
- }
- /**
- * @param contextPath The contextPath to set.
- */
- public void setContextPath(String contextPath) {
- this.contextPath = contextPath;
- }
- /**
- * @return Returns the messageNumber.
- */
- public int getMessageNumber() {
- return messageNumber;
- }
-
- /**
- * @param messageNumber
- * The messageNumber to set.
- */
- public void setMessageNumber(int messageNumber) {
- this.messageNumber = messageNumber;
- }
-
-
- /**
- * @return Returns the backupSessionID.
- */
- public String getBackupSessionID() {
- return backupSessionID;
- }
-
- /**
- * @param backupSessionID
- * The backupSessionID to set.
- */
- public void setBackupSessionID(String backupSessionID) {
- this.backupSessionID = backupSessionID;
- }
-
- /**
- * @return Returns the orignalSessionID.
- */
- public String getOrignalSessionID() {
- return orignalSessionID;
- }
-
- /**
- * @param orignalSessionID
- * The orignalSessionID to set.
- */
- public void setOrignalSessionID(String orignalSessionID) {
- this.orignalSessionID = orignalSessionID;
- }
-
- @Override
+ /**
+ * @return Returns the contextPath.
+ */
+ public String getContextPath() {
+ return contextPath;
+ }
+ /**
+ * @param contextPath The contextPath to set.
+ */
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+ /**
+ * @return Returns the messageNumber.
+ */
+ public int getMessageNumber() {
+ return messageNumber;
+ }
+
+ /**
+ * @param messageNumber
+ * The messageNumber to set.
+ */
+ public void setMessageNumber(int messageNumber) {
+ this.messageNumber = messageNumber;
+ }
+
+
+ /**
+ * @return Returns the backupSessionID.
+ */
+ public String getBackupSessionID() {
+ return backupSessionID;
+ }
+
+ /**
+ * @param backupSessionID
+ * The backupSessionID to set.
+ */
+ public void setBackupSessionID(String backupSessionID) {
+ this.backupSessionID = backupSessionID;
+ }
+
+ /**
+ * @return Returns the orignalSessionID.
+ */
+ public String getOrignalSessionID() {
+ return orignalSessionID;
+ }
+
+ /**
+ * @param orignalSessionID
+ * The orignalSessionID to set.
+ */
+ public void setOrignalSessionID(String orignalSessionID) {
+ this.orignalSessionID = orignalSessionID;
+ }
+
+ @Override
public String toString() {
- return "SESSIONID-UPDATE#" + getHost() + "." + getContextPath() + "#" + getOrignalSessionID() + ":" + getBackupSessionID();
- }
+ return "SESSIONID-UPDATE#" + getHost() + "." + getContextPath() + "#" + getOrignalSessionID() + ":" + getBackupSessionID();
+ }
}
public static final String XML_DECLARATION =
"<?xml version=\"1.0\" encoding=\""+CHARSET+"\"?>";
-
+
public static final String XML_STYLE =
"<?xml-stylesheet type=\"text/xsl\" href=\"xform.xsl\" ?>";
log("sessions: Session action '" + action + "' for web application at '" + path + "'");
}
if ("sessionDetail".equals(action)) {
- String sessionId = req.getParameter("sessionId");
- displaySessionDetailPage(req, resp, path, sessionId);
- return;
+ String sessionId = req.getParameter("sessionId");
+ displaySessionDetailPage(req, resp, path, sessionId);
+ return;
} else if ("invalidateSessions".equals(action)) {
String[] sessionIds = req.getParameterValues("sessionIds");
int i = invalidateSessions(path, sessionIds);
//orderBy = "DESC";
}
try {
- Collections.sort(activeSessions, comparator);
- } catch (IllegalStateException ise) {
- // at least 1 of the sessions is invalidated
- req.setAttribute(APPLICATION_ERROR, "Can't sort session list: one session is invalidated");
- }
+ Collections.sort(activeSessions, comparator);
+ } catch (IllegalStateException ise) {
+ // at least 1 of the sessions is invalidated
+ req.setAttribute(APPLICATION_ERROR, "Can't sort session list: one session is invalidated");
+ }
} else {
log("WARNING: unknown sort order: " + sortBy);
}
HttpSession session = getSessionForPathAndId(path, sessionId).getSession();
if (null == session) {
// Shouldn't happen, but let's play nice...
- if (debug >= 1) {
- log("WARNING: can't invalidate null session " + sessionId);
- }
+ if (debug >= 1) {
+ log("WARNING: can't invalidate null session " + sessionId);
+ }
continue;
}
try {
- session.invalidate();
- ++nbAffectedSessions;
- if (debug >= 1) {
- log("Invalidating session id " + sessionId);
- }
- } catch (IllegalStateException ise) {
- if (debug >= 1) {
- log("Can't invalidate already invalidated session id " + sessionId);
- }
- }
+ session.invalidate();
+ ++nbAffectedSessions;
+ if (debug >= 1) {
+ log("Invalidating session id " + sessionId);
+ }
+ } catch (IllegalStateException ise) {
+ if (debug >= 1) {
+ log("Can't invalidate already invalidated session id " + sessionId);
+ }
+ }
}
return nbAffectedSessions;
}
HttpSession session = getSessionForPathAndId(path, sessionId).getSession();
if (null == session) {
// Shouldn't happen, but let's play nice...
- if (debug >= 1) {
- log("WARNING: can't remove attribute '" + attributeName + "' for null session " + sessionId);
- }
+ if (debug >= 1) {
+ log("WARNING: can't remove attribute '" + attributeName + "' for null session " + sessionId);
+ }
return false;
}
boolean wasPresent = (null != session.getAttribute(attributeName));
try {
session.removeAttribute(attributeName);
} catch (IllegalStateException ise) {
- if (debug >= 1) {
- log("Can't remote attribute '" + attributeName + "' for invalidated session id " + sessionId);
- }
+ if (debug >= 1) {
+ log("Can't remote attribute '" + attributeName + "' for invalidated session id " + sessionId);
+ }
}
return wasPresent;
}
HttpSession session = getSessionForPathAndId(path, sessionId).getSession();
if (null == session) {
// Shouldn't happen, but let's play nice...
- if (debug >= 1) {
- log("WARNING: can't set timout for null session " + sessionId);
- }
+ if (debug >= 1) {
+ log("WARNING: can't set timout for null session " + sessionId);
+ }
return 0;
}
try {
- int oldMaxInactiveInterval = session.getMaxInactiveInterval();
- session.setMaxInactiveInterval(maxInactiveInterval);
- return oldMaxInactiveInterval;
+ int oldMaxInactiveInterval = session.getMaxInactiveInterval();
+ session.setMaxInactiveInterval(maxInactiveInterval);
+ return oldMaxInactiveInterval;
} catch (IllegalStateException ise) {
- if (debug >= 1) {
- log("Can't set MaxInactiveInterval '" + maxInactiveInterval + "' for invalidated session id " + sessionId);
- }
- return 0;
- }
+ if (debug >= 1) {
+ log("Can't set MaxInactiveInterval '" + maxInactiveInterval + "' for invalidated session id " + sessionId);
+ }
+ return 0;
+ }
}
protected Comparator<Session> getComparator(String sortBy) {
public static String getDisplayCreationTimeForSession(Session in_session) {
try {
- DateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT);
- return formatter.format(new Date(in_session.getCreationTime()));
+ DateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT);
+ return formatter.format(new Date(in_session.getCreationTime()));
} catch (IllegalStateException ise) {
- //ignore: invalidated session
- return "";
- }
+ //ignore: invalidated session
+ return "";
+ }
}
public static String getDisplayLastAccessedTimeForSession(Session in_session) {
try {
- DateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT);
- return formatter.format(new Date(in_session.getLastAccessedTime()));
+ DateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT);
+ return formatter.format(new Date(in_session.getLastAccessedTime()));
} catch (IllegalStateException ise) {
- //ignore: invalidated session
- return "";
- }
+ //ignore: invalidated session
+ return "";
+ }
}
public static String getDisplayUsedTimeForSession(Session in_session) {
* See also OutSupport.writeEscapedXml().
*/
public static String escapeXml(String buffer) {
- if (buffer == null) {
- return "";
- }
+ if (buffer == null) {
+ return "";
+ }
int start = 0;
int length = buffer.length();
char[] arrayBuffer = buffer.toCharArray();
}
public static String formatNumber(long number) {
- return NumberFormat.getNumberInstance().format(number);
+ return NumberFormat.getNumberInstance().format(number);
}
}
/**
* The list of Realms contained by this Realm.
*/
- protected List<Realm> realms = new LinkedList<Realm>();
-
-
- /**
- * Add a realm to the list of realms that will be used to authenticate
- * users.
- */
- public void addRealm(Realm theRealm) {
- realms.add(theRealm);
-
- if (log.isDebugEnabled()) {
- sm.getString("combinedRealm.addRealm", theRealm.getInfo(),
- Integer.toString(realms.size()));
- }
- }
-
-
- /**
- * Return the set of Realms that this Realm is wrapping
- */
- public ObjectName[] getRealms() {
- ObjectName[] result = new ObjectName[realms.size()];
- for (Realm realm : realms) {
- if (realm instanceof RealmBase) {
- result[realms.indexOf(realm)] =
- ((RealmBase) realm).getObjectName();
- }
- }
- return result;
- }
+ protected List<Realm> realms = new LinkedList<Realm>();
+
+
+ /**
+ * Add a realm to the list of realms that will be used to authenticate
+ * users.
+ */
+ public void addRealm(Realm theRealm) {
+ realms.add(theRealm);
+
+ if (log.isDebugEnabled()) {
+ sm.getString("combinedRealm.addRealm", theRealm.getInfo(),
+ Integer.toString(realms.size()));
+ }
+ }
+
+
+ /**
+ * Return the set of Realms that this Realm is wrapping
+ */
+ public ObjectName[] getRealms() {
+ ObjectName[] result = new ObjectName[realms.size()];
+ for (Realm realm : realms) {
+ if (realm instanceof RealmBase) {
+ result[realms.indexOf(realm)] =
+ ((RealmBase) realm).getObjectName();
+ }
+ }
+ return result;
+ }
/**
@Override
protected void startInternal() throws LifecycleException {
// Start 'sub-realms' then this one
- Iterator<Realm> iter = realms.iterator();
-
+ Iterator<Realm> iter = realms.iterator();
+
while (iter.hasNext()) {
- Realm realm = iter.next();
+ Realm realm = iter.next();
if (realm instanceof Lifecycle) {
- try {
- ((Lifecycle) realm).start();
- } catch (LifecycleException e) {
- // If realm doesn't start can't authenticate against it
- iter.remove();
- log.error(sm.getString("combinedRealm.realmStartFail",
- realm.getInfo()), e);
- }
+ try {
+ ((Lifecycle) realm).start();
+ } catch (LifecycleException e) {
+ // If realm doesn't start can't authenticate against it
+ iter.remove();
+ log.error(sm.getString("combinedRealm.realmStartFail",
+ realm.getInfo()), e);
+ }
}
}
super.startInternal();
* <code><description>/<version></code>.
*/
@Override
- public String getInfo() {
+ public String getInfo() {
return info;
*/
@Override
public Principal authenticate(String username, String credentials) {
-
- // No user or no credentials
+
+ // No user or no credentials
// Can't possibly authenticate, don't bother the database then
- if (username == null || credentials == null) {
- return null;
- }
+ if (username == null || credentials == null) {
+ return null;
+ }
- Connection dbConnection = null;
+ Connection dbConnection = null;
// Ensure that we have an open database connection
dbConnection = open();
// Acquire a Principal object for this user
Principal principal = authenticate(dbConnection, username, credentials);
- close(dbConnection);
+ close(dbConnection);
- return principal;
+ return principal;
}
((StandardServer)getServer()).getGlobalNamingContext();
}
DataSource dataSource = (DataSource)context.lookup(dataSourceName);
- return dataSource.getConnection();
+ return dataSource.getConnection();
} catch (Exception e) {
// Log the problem for posterity
containerLog.error(sm.getString("dataSourceRealm.exception"), e);
}
try {
- return getPassword(dbConnection, username);
+ return getPassword(dbConnection, username);
} finally {
close(dbConnection);
}
* @param username Username for which password should be retrieved
*/
protected String getPassword(Connection dbConnection,
- String username) {
+ String username) {
ResultSet rs = null;
PreparedStatement stmt = null;
sm.getString("dataSourceRealm.getPassword.exception",
username));
} finally {
- try {
- if (rs != null) {
- rs.close();
- }
- if (stmt != null) {
- stmt.close();
- }
- } catch (SQLException e) {
+ try {
+ if (rs != null) {
+ rs.close();
+ }
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (SQLException e) {
containerLog.error(
sm.getString("dataSourceRealm.getPassword.exception",
- username));
-
- }
+ username));
+
+ }
}
return null;
*/
@Override
protected Principal getPrincipal(String username) {
- Connection dbConnection = open();
+ Connection dbConnection = open();
if (dbConnection == null) {
return new GenericPrincipal(username, null, null);
}
try {
- return (new GenericPrincipal(username,
- getPassword(dbConnection, username),
- getRoles(dbConnection, username)));
+ return (new GenericPrincipal(username,
+ getPassword(dbConnection, username),
+ getRoles(dbConnection, username)));
} finally {
- close(dbConnection);
+ close(dbConnection);
}
}
try {
return getRoles(dbConnection, username);
} finally {
- close(dbConnection);
+ close(dbConnection);
}
}
*/
protected ArrayList<String> getRoles(Connection dbConnection,
String username) {
-
+
ResultSet rs = null;
PreparedStatement stmt = null;
ArrayList<String> list = null;
-
+
try {
- stmt = roles(dbConnection, username);
- rs = stmt.executeQuery();
- list = new ArrayList<String>();
-
- while (rs.next()) {
- String role = rs.getString(1);
- if (role != null) {
- list.add(role.trim());
- }
- }
- return list;
- } catch(SQLException e) {
+ stmt = roles(dbConnection, username);
+ rs = stmt.executeQuery();
+ list = new ArrayList<String>();
+
+ while (rs.next()) {
+ String role = rs.getString(1);
+ if (role != null) {
+ list.add(role.trim());
+ }
+ }
+ return list;
+ } catch(SQLException e) {
containerLog.error(
sm.getString("dataSourceRealm.getRoles.exception", username));
}
- finally {
- try {
- if (rs != null) {
- rs.close();
- }
- if (stmt != null) {
- stmt.close();
- }
- } catch (SQLException e) {
+ finally {
+ try {
+ if (rs != null) {
+ rs.close();
+ }
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (SQLException e) {
containerLog.error(
sm.getString("dataSourceRealm.getRoles.exception",
username));
- }
+ }
}
-
- return null;
+
+ return null;
}
/**
* <code><description>/<version></code>.
*/
@Override
- public String getInfo() {
+ public String getInfo() {
return info;
* <code><description>/<version></code>.
*/
@Override
- public String getInfo() {
+ public String getInfo() {
return info;
* <code><description>/<version></code>.
*/
@Override
- public String getInfo() {
+ public String getInfo() {
return info;
if (derefAliases != null)
env.put(JNDIRealm.DEREF_ALIASES, derefAliases);
if (connectionTimeout != null)
- env.put("com.sun.jndi.ldap.connect.timeout", connectionTimeout);
+ env.put("com.sun.jndi.ldap.connect.timeout", connectionTimeout);
return env;
}
return false;
}
-
+
// ------------------------------------------------------ Protected Methods
CacheEntry cacheEntry = resources.lookupCache(path);
if (!cacheEntry.exists) {
- // File is in directory listing but doesn't appear to exist
- // Broken symlink or odd permission settings?
- return;
+ // File is in directory listing but doesn't appear to exist
+ // Broken symlink or odd permission settings?
+ return;
}
generatedXML.writeElement(null, "D:response", XMLWriter.OPENING);
+ sessionTable + " WHERE " + sessionAppCol
+ " = ?";
preparedKeysSql = _conn.prepareStatement(keysSql);
- }
+ }
preparedKeysSql.setString(1, getName());
rst = preparedKeysSql.executeQuery();
+ ") FROM " + sessionTable + " WHERE "
+ sessionAppCol + " = ?";
preparedSizeSql = _conn.prepareStatement(sizeSql);
- }
+ }
preparedSizeSql.setString(1, getName());
rst = preparedSizeSql.executeQuery();
+ sessionLastAccessedCol
+ ") VALUES (?, ?, ?, ?, ?, ?)";
preparedSaveSql = _conn.prepareStatement(saveSql);
- }
+ }
preparedSaveSql.setString(1, session.getIdInternal());
preparedSaveSql.setString(2, getName());
ExceptionUtils.handleThrowable(f);
}
- try {
+ try {
preparedRemoveSql.close();
} catch (Throwable f) {
ExceptionUtils.handleThrowable(f);
* Sessions currently being swapped in and the associated locks
*/
private final Map<String,Object> sessionSwapInLocks =
- new HashMap<String,Object>();
+ new HashMap<String,Object>();
// ------------------------------------------------------------- Properties
/**
- * Indicates how many seconds old a session can get, after its last use in a
- * request, before it should be backed up to the store. -1 means sessions
- * are not backed up.
- */
+ * Indicates how many seconds old a session can get, after its last use in a
+ * request, before it should be backed up to the store. -1 means sessions
+ * are not backed up.
+ */
public int getMaxIdleBackup() {
return maxIdleBackup;
/**
- * Set the Container with which this Manager has been associated. If it is a
- * Context (the usual case), listen for changes to the session timeout
- * property.
- *
- * @param container
- * The associated Container
- */
+ * Set the Container with which this Manager has been associated. If it is a
+ * Context (the usual case), listen for changes to the session timeout
+ * property.
+ *
+ * @param container
+ * The associated Container
+ */
@Override
public void setContainer(Container container) {
/**
* Implements the Manager interface, direct call to processExpires and processPersistenceChecks
*/
- @Override
+ @Override
public void processExpires() {
-
+
long timeNow = System.currentTimeMillis();
Session sessions[] = findSessions();
int expireHere = 0 ;
if(log.isDebugEnabled())
log.debug("End expire sessions " + getName() + " processingTime " + (timeEnd - timeNow) + " expired sessions: " + expireHere);
processingTime += (timeEnd - timeNow);
-
- }
+
+ }
/**
* @param captureServletOutputStream The ServletOutputStream to use
*/
public ResponseIncludeWrapper(ServletContext context,
- HttpServletRequest request, HttpServletResponse response,
- ServletOutputStream captureServletOutputStream) {
+ HttpServletRequest request, HttpServletResponse response,
+ ServletOutputStream captureServletOutputStream) {
super(response);
this.context = context;
this.request = request;
if (contentType == null) {
String url = request.getRequestURI();
String mime = context.getMimeType(url);
- if (mime != null)
- {
+ if (mime != null) {
setContentType(mime);
- }
- else
- {
- // return a safe value
- setContentType("application/x-octet-stream");
+ } else {
+ // return a safe value
+ setContentType("application/x-octet-stream");
}
}
return contentType;
* @throws SSIStopProcessingException
* if SSI processing should be aborted
*/
- public long process(SSIMediator ssiMediator, String commandName,
+ public long process(SSIMediator ssiMediator, String commandName,
String[] paramNames, String[] paramValues, PrintWriter writer)
throws SSIStopProcessingException;
}
\ No newline at end of file
public long process(SSIMediator ssiMediator, String commandName,
String[] paramNames, String[] paramValues, PrintWriter writer)
throws SSIStopProcessingException {
- // Assume anything using conditionals was modified by it
- long lastModified = System.currentTimeMillis();
+ // Assume anything using conditionals was modified by it
+ long lastModified = System.currentTimeMillis();
// Retrieve the current state information
SSIConditionalState state = ssiMediator.getConditionalState();
if ("if".equalsIgnoreCase(commandName)) {
String substitutedValue = ssiMediator.substituteVariables(paramValue);
if (paramName.equalsIgnoreCase("cgi")) {
lastModified = ssiInclude.process(ssiMediator, "include",
- new String[]{"virtual"}, new String[]{substitutedValue},
- writer);
+ new String[]{"virtual"}, new String[]{substitutedValue},
+ writer);
} else if (paramName.equalsIgnoreCase("cmd")) {
boolean foundProgram = false;
try {
* @see org.apache.catalina.ssi.SSIServlet
*/
public class SSIFilter implements Filter {
- protected FilterConfig config = null;
+ protected FilterConfig config = null;
/** Debug level for this servlet. */
protected int debug = 0;
/** Expiration time in seconds for the doc. */
/** virtual path can be webapp-relative */
protected boolean isVirtualWebappRelative = false;
/** regex pattern to match when evaluating content types */
- protected Pattern contentTypeRegEx = null;
- /** default pattern for ssi filter content type matching */
- protected Pattern shtmlRegEx =
+ protected Pattern contentTypeRegEx = null;
+ /** default pattern for ssi filter content type matching */
+ protected Pattern shtmlRegEx =
Pattern.compile("text/x-server-parsed-html(;.*)?");
- /** Allow exec (normally blocked for security) */
- protected boolean allowExec = false;
+ /** Allow exec (normally blocked for security) */
+ protected boolean allowExec = false;
//----------------- Public methods.
* if an error occurs
*/
public void init(FilterConfig config) throws ServletException {
- this.config = config;
-
+ this.config = config;
+
if (config.getInitParameter("debug") != null) {
debug = Integer.parseInt(config.getInitParameter("debug"));
}
Matcher shtmlMatcher =
shtmlRegEx.matcher(responseIncludeWrapper.getContentType());
if (shtmlMatcher.matches()) {
- // Convert shtml mime type to ordinary html mime type but preserve
+ // Convert shtml mime type to ordinary html mime type but preserve
// encoding, if any.
- String enc = shtmlMatcher.group(1);
- res.setContentType("text/html" + ((enc != null) ? enc : ""));
+ String enc = shtmlMatcher.group(1);
+ res.setContentType("text/html" + ((enc != null) ? enc : ""));
}
}
*/
public long process(SSIMediator ssiMediator, String commandName,
String[] paramNames, String[] paramValues, PrintWriter writer) {
- long lastModified = 0;
+ long lastModified = 0;
String configErrMsg = ssiMediator.getConfigErrMsg();
for (int i = 0; i < paramNames.length; i++) {
String paramName = paramNames[i];
|| paramName.equalsIgnoreCase("virtual")) {
boolean virtual = paramName.equalsIgnoreCase("virtual");
lastModified = ssiMediator.getFileLastModified(
- substitutedValue, virtual);
+ substitutedValue, virtual);
String text = ssiMediator.getFileText(substitutedValue,
virtual);
writer.write(text);
*/
public long process(SSIMediator ssiMediator, String commandName,
String[] paramNames, String[] paramValues, PrintWriter writer) {
- long lastModified = 0;
+ long lastModified = 0;
//any arguments should produce an error
if (paramNames.length > 0) {
String errorMessage = ssiMediator.getConfigErrMsg();
* Return specified property value.
*/
public static String getProperty(String name) {
-
+
return properties.getProperty(name);
}
*/
public Connector createConnector(InetAddress address, int port,
boolean secure) {
- return createConnector(address != null? address.toString() : null,
- port, secure);
+ return createConnector(address != null? address.toString() : null,
+ port, secure);
}
public Connector createConnector(String address, int port,
public Connector createConnector(InetAddress address, int port,
String protocol) {
- return createConnector(address != null? address.toString() : null,
- port, protocol);
+ return createConnector(address != null? address.toString() : null,
+ port, protocol);
}
public Connector createConnector(String address, int port,
- String protocol) {
+ String protocol) {
Connector connector = null;
- if (address != null) {
- /*
- * InetAddress.toString() returns a string of the form
- * "<hostname>/<literal_IP>". Get the latter part, so that the
- * address can be parsed (back) into an InetAddress using
- * InetAddress.getByName().
- */
- int index = address.indexOf('/');
- if (index != -1) {
- address = address.substring(index + 1);
- }
- }
-
- if (log.isDebugEnabled()) {
+ if (address != null) {
+ /*
+ * InetAddress.toString() returns a string of the form
+ * "<hostname>/<literal_IP>". Get the latter part, so that the
+ * address can be parsed (back) into an InetAddress using
+ * InetAddress.getByName().
+ */
+ int index = address.indexOf('/');
+ if (index != -1) {
+ address = address.substring(index + 1);
+ }
+ }
+
+ if (log.isDebugEnabled()) {
log.debug("Creating connector for address='" +
- ((address == null) ? "ALL" : address) +
- "' port='" + port + "' protocol='" + protocol + "'");
- }
+ ((address == null) ? "ALL" : address) +
+ "' port='" + port + "' protocol='" + protocol + "'");
+ }
try {
* on which the application was deployed
*/
public long getDeploymentTime(String name) {
- DeployedApplication app = deployed.get(name);
- if (app == null) {
- return 0L;
- }
-
- return app.timestamp;
+ DeployedApplication app = deployed.get(name);
+ if (app == null) {
+ return 0L;
+ }
+
+ return app.timestamp;
}
* the monitored resources.
*/
protected class DeployedApplication {
- public DeployedApplication(String name) {
- this.name = name;
- }
-
- /**
- * Application context path. The assertion is that
- * (host.getChild(name) != null).
- */
- public String name;
-
- /**
- * Any modification of the specified (static) resources will cause a
- * redeployment of the application. If any of the specified resources is
- * removed, the application will be undeployed. Typically, this will
- * contain resources like the context.xml file, a compressed WAR path.
+ public DeployedApplication(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Application context path. The assertion is that
+ * (host.getChild(name) != null).
+ */
+ public String name;
+
+ /**
+ * Any modification of the specified (static) resources will cause a
+ * redeployment of the application. If any of the specified resources is
+ * removed, the application will be undeployed. Typically, this will
+ * contain resources like the context.xml file, a compressed WAR path.
* The value is the last modification time.
- */
- public LinkedHashMap<String, Long> redeployResources =
- new LinkedHashMap<String, Long>();
-
- /**
- * Any modification of the specified (static) resources will cause a
- * reload of the application. This will typically contain resources
- * such as the web.xml of a webapp, but can be configured to contain
- * additional descriptors.
+ */
+ public LinkedHashMap<String, Long> redeployResources =
+ new LinkedHashMap<String, Long>();
+
+ /**
+ * Any modification of the specified (static) resources will cause a
+ * reload of the application. This will typically contain resources
+ * such as the web.xml of a webapp, but can be configured to contain
+ * additional descriptors.
* The value is the last modification time.
- */
- public HashMap<String, Long> reloadResources =
- new HashMap<String, Long>();
-
- /**
- * Instant where the application was last put in service.
- */
- public long timestamp = System.currentTimeMillis();
+ */
+ public HashMap<String, Long> reloadResources =
+ new HashMap<String, Long>();
+
+ /**
+ * Instant where the application was last put in service.
+ */
+ public long timestamp = System.currentTimeMillis();
}
}
if ( domain == null ) return;
if (domain.startsWith("{"))
setDomain(org.apache.catalina.tribes.util.Arrays.fromString(domain));
- else
+ else
setDomain(org.apache.catalina.tribes.util.Arrays.convert(domain));
}
}
public int getRecoveryCounter(){
- String p = properties.getProperty("recoveryCounter");
- if(p != null){
- return new Integer(p).intValue();
- }
- return -1;
+ String p = properties.getProperty("recoveryCounter");
+ if(p != null){
+ return new Integer(p).intValue();
+ }
+ return -1;
}
public void setRecoveryEnabled(boolean recoveryEnabled) {
}
public boolean getRecoveryEnabled() {
- String p = properties.getProperty("recoveryEnabled");
- if(p != null){
- return new Boolean(p).booleanValue();
- }
- return false;
+ String p = properties.getProperty("recoveryEnabled");
+ if(p != null){
+ return new Boolean(p).booleanValue();
+ }
+ return false;
}
public void setRecoverySleepTime(long recoverySleepTime) {
}
public long getRecoverySleepTime(){
- String p = properties.getProperty("recoverySleepTime");
- if(p != null){
- return new Long(p).longValue();
- }
- return -1;
+ String p = properties.getProperty("recoverySleepTime");
+ if(p != null){
+ return new Long(p).longValue();
+ }
+ return -1;
}
public void setLocalLoopbackDisabled(boolean localLoopbackDisabled) {
}
public boolean getLocalLoopbackDisabled(boolean localLoopbackDisabled) {
- String p = properties.getProperty("localLoopbackDisabled");
- if(p != null){
- return new Boolean(p).booleanValue();
- }
- return false;
+ String p = properties.getProperty("localLoopbackDisabled");
+ if(p != null){
+ return new Boolean(p).booleanValue();
+ }
+ return false;
}
/**
}
socket.setLoopbackMode(localLoopbackDisabled); //hint if we want disable loop back(local machine) messages
if (mcastBindAddress != null) {
- if(log.isInfoEnabled())
+ if(log.isInfoEnabled())
log.info("Setting multihome multicast interface to:" +mcastBindAddress);
socket.setInterface(mcastBindAddress);
} //end if
socket.setSoTimeout(mcastSoTimeout);
if ( mcastTTL >= 0 ) {
- if(log.isInfoEnabled())
+ if(log.isInfoEnabled())
log.info("Setting cluster mcast TTL to " + mcastTTL);
socket.setTimeToLive(mcastTTL);
}
public synchronized void serviceSocket(Socket socket, ObjectReader reader) {
this.socket = socket;
this.reader = reader;
- this.notify(); // awaken the thread
+ this.notify(); // awaken the thread
}
protected void execute(ObjectReader reader) throws Exception{
buffer.clear();
}
if (key == null) {
- return; // just in case
+ return; // just in case
}
if ( log.isTraceEnabled() )
log.trace("Servicing key:"+key);
reader.access();
ReadableByteChannel channel = (ReadableByteChannel) key.channel();
int count=-1;
- buffer.clear(); // make buffer empty
+ buffer.clear(); // make buffer empty
SocketAddress saddr = null;
if (channel instanceof SocketChannel) {
// loop while data available, channel is non-blocking
while ((count = channel.read (buffer)) > 0) {
- buffer.flip(); // make buffer readable
+ buffer.flip(); // make buffer readable
if ( buffer.hasArray() )
reader.append(buffer.array(),0,count,false);
else
reader.append(buffer,count,false);
- buffer.clear(); // make buffer empty
+ buffer.clear(); // make buffer empty
//do we have at least one package?
if ( reader.hasPackage() ) break;
}
public class ExecutorFactory {
- public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit) {
- TaskQueue taskqueue = new TaskQueue();
- ThreadPoolExecutor service = new ThreadPoolExecutor(minThreads, maxThreads, maxIdleTime, unit,taskqueue);
- taskqueue.setParent(service);
- return service;
- }
+ public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit) {
+ TaskQueue taskqueue = new TaskQueue();
+ ThreadPoolExecutor service = new ThreadPoolExecutor(minThreads, maxThreads, maxIdleTime, unit,taskqueue);
+ taskqueue.setParent(service);
+ return service;
+ }
- public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit, ThreadFactory threadFactory) {
- TaskQueue taskqueue = new TaskQueue();
- ThreadPoolExecutor service = new ThreadPoolExecutor(minThreads, maxThreads, maxIdleTime, unit,taskqueue, threadFactory);
- taskqueue.setParent(service);
- return service;
- }
-
- // ---------------------------------------------- TaskQueue Inner Class
+ public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit, ThreadFactory threadFactory) {
+ TaskQueue taskqueue = new TaskQueue();
+ ThreadPoolExecutor service = new ThreadPoolExecutor(minThreads, maxThreads, maxIdleTime, unit,taskqueue, threadFactory);
+ taskqueue.setParent(service);
+ return service;
+ }
+
+ // ---------------------------------------------- TaskQueue Inner Class
private static class TaskQueue extends LinkedBlockingQueue<Runnable> {
ThreadPoolExecutor parent = null;