Java Doc for Context.java in  » Development » Javolution » javolution » context » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » Javolution » javolution.context 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javolution.context.Context

All known Subclasses:   javolution.context.PersistentContext,  javolution.context.LogContext,  javolution.context.SecurityContext,  javolution.context.ConcurrentContext,  javolution.context.AllocatorContext,  javolution.context.LocalContext,
Context
abstract public class Context implements XMLSerializable(Code)

This class represents an execution context; they can be associated to particular threads or objects.

Context-aware applications may extend the context base class or any predefined contexts in order to facilitate separation of concerns.

The scope of a Context should be surrounded by a try, finally block statement to ensure correct behavior in case of exceptions being raised. For example:[code] LocalContext.enter(); // Current thread enter a local context. try ModuloInteger.setModulus(m); // No impact on other threads! z = x.times(y); // Multiplication modulo m. } finally { LocalContext.exit(); }[/code]


author:
   Jean-Marie Dautelle
version:
   5.0, April 15, 2007


Field Summary
final public static  ContextROOT
     Holds the root context (top context of all threads).

Constructor Summary
protected  Context()
     Default constructor.

Method Summary
final public static  Contextenter(Context context)
     Enters the specified context.
Parameters:
  context - the context being entered.
final public static  Contextenter(Class contextType)
     Enters a factory produced context of specified type to be recycled after Context.exit exiting . This method is called by the static enter() method of specialized contexts.
abstract protected  voidenterAction()
     The action to be performed after this context becomes the current context.
public static  Contextexit()
     Exits the current context (the Context.getOuter outer context becomes the current context).
final public static  voidexit(Context ctx)
    
abstract protected  voidexitAction()
     The action to be performed before this context is no more the current context.
final  AllocatorContextgetAllocatorContext()
     Returns the allocator context used while in this context (shortcut).
public static  ContextgetCurrent()
     Returns the current context for the current thread.
final public  ContextgetOuter()
     Returns the outer context of this context or null if Context.ROOT .
final public  ThreadgetOwner()
     Returns the current owner of this context.
protected static  voidsetCurrent(ConcurrentContext context)
     Sets the current context, used by ConcurrentContext exclusively.
public  StringtoString()
     Returns the string representation of this context (default "Instance of " + this.getClass().getName()).

Field Detail
ROOT
final public static Context ROOT(Code)
Holds the root context (top context of all threads).




Constructor Detail
Context
protected Context()(Code)
Default constructor.




Method Detail
enter
final public static Context enter(Context context)(Code)
Enters the specified context.
Parameters:
  context - the context being entered. the specified context.
throws:
  IllegalStateException - if this context is currently in use.



enter
final public static Context enter(Class contextType)(Code)
Enters a factory produced context of specified type to be recycled after Context.exit exiting . This method is called by the static enter() method of specialized contexts. If the context class has no public no-arg constructor accessible, then the factory for the class should be ObjectFactory.setInstance explicitely set (typically in a static initializer).
Parameters:
  contextType - the type of context being entered. the context being entered.
See Also:   ObjectFactory.getInstance(Class)



enterAction
abstract protected void enterAction()(Code)
The action to be performed after this context becomes the current context.



exit
public static Context exit()(Code)
Exits the current context (the Context.getOuter outer context becomes the current context). the context which has been exited.
throws:
  IllegalStateException - if this context is the Context.ROOT context.



exit
final public static void exit(Context ctx)(Code)
Context.exit()



exitAction
abstract protected void exitAction()(Code)
The action to be performed before this context is no more the current context.



getAllocatorContext
final AllocatorContext getAllocatorContext()(Code)
Returns the allocator context used while in this context (shortcut). the allocator context for this context.



getCurrent
public static Context getCurrent()(Code)
Returns the current context for the current thread. the current context.



getOuter
final public Context getOuter()(Code)
Returns the outer context of this context or null if Context.ROOT . the outer context or null.



getOwner
final public Thread getOwner()(Code)
Returns the current owner of this context. The owner of a context is the thread which Context.enter(Context) entered the context and has not yet Context.exit(Context) exited . A context can only have one owner at any given time, although contexts can be shared by ConcurrentContext concurrent threads. the thread owner of this context or null.



setCurrent
protected static void setCurrent(ConcurrentContext context)(Code)
Sets the current context, used by ConcurrentContext exclusively.
Parameters:
  context - the concurrent context.



toString
public String toString()(Code)
Returns the string representation of this context (default "Instance of " + this.getClass().getName()). the string representation of this context.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.