Concurrency, reflection and Factory pattern



Hi everyone,

Here is my problem:

Case:
- server application which launches concurrently tasks (precisely
classes extending class Task)
- new types of task can be registered at the server by the developer
- only class of task which matches incoming request, is launched

Proposed solution:
- Developer registers not instances of tasks, but their classes in the
server
- If static method matches() of one task's class returns true, then
this class is instancianized by use of Java reflection

Pros:
1. no instance of Task class is necessary to check its matching
condition
2. both: matching condition and related solve() method are defined in a
single class

Cons:
1. this approach is easy to abuse, since static methods cannot be
abstract and or overriden, which does not force developer to implement
them in classes which derive from Task class.

I was wondering about using Factory pattern, which creates instances of
class, but this forces me to break 2nd advantage. Do you see any other
solution ?

TIA,
Maciej

ps. Here is example of Task class

public abstract class Task<R,T> {

private R request;

/* This method must be implemented in deriving class */
public abstract T solve();

/* This method method must be over-hidden in deriving class. */
public static boolean matches(R request) {
return false;
}

public Task(R request) {
this.request = request;
}

.



Relevant Pages

  • [REVS] NTLM HTTP Authentication is Insecure By Design
    ... in front of a web server, and that proxy server shares a single TCP ... These are attacks that make use of non-RFC HTTP requests (HTTP Request ... the authentication is associated with the ...
    (Securiteam)
  • [NT] 04WebServer Multiple Vulnerabilities (CSS, Log File Injection, AUX DoS)
    ... 04WebServer is a HTTP server developed by Soft3304 for Windows platforms. ... Characters into Log File ... filtering on the request URL before writing it into the log file. ... following HTTP request, when submitted to a vulnerable 04WebServer, will ...
    (Securiteam)
  • Re: breaking the model
    ... > The forms data then is in the Request object. ... HTTP Request; in this case, the form POST Request from the Page. ... client and server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Anonymous Anonymity - Request For Comments
    ... > and request that you reply directly to my e-mail address. ... > for the entity wishing to preserve their anonymity. ... > the machine can perform as a Intermediary Server and / or as a Intermediary ... > The software then attempts connection to a Intermediary Server. ...
    (Bugtraq)
  • Multiple Vulnerabilities in Sun-One Application Server
    ... Multiple Vulnerabilities in Sun-One Application Server ... on Windows 2000, SPI Labs discovered a number of vulnerabilities. ... the case of the file extension in the HTTP request. ...
    (Bugtraq)