The following comment has been added to this issue:
Author: Howard M. Lewis Ship
Created: Sat, 17 Jul 2004 2:48 PM
Body:
You can use a threaded service model, rather than new. It will be associated
with just the current thread and can hold state. It will be discarded at the
end of the current request/transaction (i.e., when you invoke
Registry.cleanupThread() ).
I'm using this approach in Tapestry 3.1; I have a service that holds the
current request and response objects (provided by the Servlet API), and that
service is threaded. All the other services are singleton, and the few that
need to know about the current request can retrieve that data as needed from
the RequestHolder service (or whatever I called it).
Remember that proxies to threaded services can be shared between threads (but
that each thread will be connected to its own, unique, private service
implementation).
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/HIVEMIND-14?page=comments#action_36725
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/HIVEMIND-14
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HIVEMIND-14
Summary: Add a new model named "new" to constuct the class
Type: New Feature
Status: Open
Priority: Major
Project: HiveMind
Components:
framework
Versions:
1.0
Assignee: Howard M. Lewis Ship
Reporter: patofan
Created: Mon, 28 Jun 2004 8:03 AM
Updated: Sat, 17 Jul 2004 2:48 PM
Environment: window XP , JDK1.4.2
Description:
I need a "new model" feature to create new instance at each calling the
service.
For example as following :
/* XML configuration */
<service-point id="ERPOrder" interface="test.Order" model="new">
<create-instance class="test.OrderImpl"/>
</service-point>
/* java code */
import org.apache.hivemind.Registry;
import org.apache.hivemind.impl.RegistryBuilder;
public class Main
{
public static void main(String[] args)
{
Registry registry = RegistryBuilder.constructDefaultRegistry();
test.Order order1 =
(test.Order) registry.getService("ERPOrder", test.OrderImpl.class);
test.Order order2 =
(test.Order) registry.getService("ERPOrder", test.OrderImpl.class);
/* I hope the result is " order1 is not equal to order2". */
System.out.println( "result of order1 and order2 is " + ( order1 !=
order2 ) ? "not equal" : "equal" );
}
}
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]