[jgentle] r82 committed - optimize javadocs and code, increase more performance to pooled instan...

2 views
Skip to first unread message

codesite...@google.com

unread,
Aug 4, 2009, 8:38:58 PM8/4/09
to jgentl...@googlegroups.com
Revision: 82
Author: Skydunkpro
Date: Tue Aug 4 17:37:58 2009
Log: optimize javadocs and code, increase more performance to pooled
instance
http://code.google.com/p/jgentle/source/detail?r=82

Modified:
/trunk/JGentleProject/src/org/jgentleframework/configure/ConfigModule.java
/trunk/JGentleProject/src/org/jgentleframework/configure/REF.java

/trunk/JGentleProject/src/org/jgentleframework/configure/annotation/Block.java

/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CommonFactory.java

/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/AnnotationAroundAdviceMethodInterceptor.java

/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/InvocationInOutjectionMethodInterceptor.java

/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/ThrowsAdviceStackMethodInterceptor.java

/trunk/JGentleProject/src/org/jgentleframework/core/reflection/metadata/AnnoMeta.java

/trunk/JGentleProject/src/org/jgentleframework/core/reflection/metadata/DefinitionCore.java

/trunk/JGentleProject/src/org/jgentleframework/services/objectpooling/AbstractBaseController.java

/trunk/JGentleProject/src/org/jgentleframework/services/objectpooling/CommonPool.java

=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/configure/ConfigModule.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/configure/ConfigModule.java
Tue Aug 4 17:37:58 2009
@@ -17,7 +17,7 @@
*/
package org.jgentleframework.configure;

-import java.util.ArrayList;
+import java.util.List;
import java.util.Map;

/**
@@ -31,7 +31,7 @@
/**
* Returns the {@link Map} containing all configured information.
*/
- Map<String, ArrayList<?>> getOptionsList();
+ Map<String, List<?>> getOptionsList();

/**
* Returns the target object class of current proxy.
=======================================
--- /trunk/JGentleProject/src/org/jgentleframework/configure/REF.java Fri
May 15 05:16:41 2009
+++ /trunk/JGentleProject/src/org/jgentleframework/configure/REF.java Tue
Aug 4 17:37:58 2009
@@ -32,7 +32,6 @@
*
* @param ID
* the ID of specified {@link Definition}
- * @return the string
*/
public static final String ref(String ID) {

@@ -44,7 +43,6 @@
*
* @param constantName
* name of constant
- * @return the string
*/
public static final String refConstant(String constantName) {

@@ -56,8 +54,6 @@
* when binding bean by {@link BindingConfig#bind()} method and its
* overloadings. In other cases, using this method is the cause of
* unforeseen exceptions.
- *
- * @return the string
*/
public static final String refMapping() {

@@ -69,7 +65,6 @@
*
* @param mappingName
* name of specified mapping.
- * @return the string
*/
public static final String refMapping(String mappingName) {

@@ -81,7 +76,6 @@
*
* @param type
* the given type
- * @return the string
*/
public static final String refMapping(Class<?> type) {

=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/configure/annotation/Block.java
Sun Jul 26 11:58:11 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/configure/annotation/Block.java
Tue Aug 4 17:37:58 2009
@@ -23,11 +23,11 @@
import java.lang.annotation.Target;

/**
- * Chỉ định một khối cấu hình. Khối cấu hình chịu trách nhiệm ràng buộc
tất cả
- * các lời triệu gọi phương thức cấu hình trong một method của configurable
- * class là đồng nhất tương ứng với một hoặc nhiều config instance chỉ
định. Các
- * config instance được chỉ định tách biệt bởi kiểu type (interface) của
chúng
- * lúc implements của configurable class.
+ * Represents a block configuration method. Chỉ định một khối cấu hình.
Khối cấu
+ * hình chịu trách nhiệm ràng buộc tất cả các lời triệu gọi phương thức
cấu hình
+ * trong một method của configurable class là đồng nhất tương ứng với một
hoặc
+ * nhiều config instance chỉ định. Các config instance được chỉ định tách
biệt
+ * bởi kiểu type (interface) của chúng lúc implements của configurable
class.
*
* @author LE QUOC CHUNG - mailto: <a
* href="mailto:skydu...@yahoo.com">skydu...@yahoo.com</a>
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CommonFactory.java
Sun Jul 26 11:58:11 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/factory/support/CommonFactory.java
Tue Aug 4 17:37:58 2009
@@ -22,6 +22,9 @@
import java.lang.reflect.Modifier;
import java.util.List;

+import net.sf.cglib.reflect.FastClass;
+import net.sf.cglib.reflect.FastMethod;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jgentleframework.context.beans.DefinitionAware;
@@ -98,8 +101,10 @@
if (methods != null && methods.size() != 0) {
for (Method method : methods) {
if (Modifier.isPublic(method.getModifiers())) {
- method.setAccessible(true);
- method.invoke(obj);
+ FastClass fclass = FastClass.create(method
+ .getDeclaringClass());
+ FastMethod fmethod = fclass.getMethod(method);
+ fmethod.invoke(obj, null);
}
else {
if (log.isErrorEnabled()) {
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/AnnotationAroundAdviceMethodInterceptor.java
Tue Jul 21 19:08:49 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/AnnotationAroundAdviceMethodInterceptor.java
Tue Aug 4 17:37:58 2009
@@ -23,6 +23,7 @@
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;

import org.aopalliance.intercept.MethodInterceptor;
@@ -44,6 +45,7 @@
* href="mailto:skydu...@yahoo.com">skydu...@yahoo.com</a>
* @date Sep 21, 2008
* @see MethodInterceptor
+ * @see RuntimeLoading
*/
class AnnotationAroundAdviceMethodInterceptor extends AbstractBeforeAdvice
implements RuntimeLoading {
@@ -51,10 +53,10 @@
boolean runtimeLoading = false;

/** The attributes mapping. */
- HashMap<Method, Object> attributesMapping = new HashMap<Method,
Object>();
+ Map<Method, Object> attributesMapping = new HashMap<Method, Object>();

/** The outject method map. */
- HashMap<Method, Outject> outjectMethodMap = new HashMap<Method,
Outject>();
+ Map<Method, Outject> outjectMethodMap = new HashMap<Method, Outject>();

/** The provider. */
final Provider provider;
@@ -62,6 +64,7 @@
/** The target class. */
final Class<? extends Annotation> targetClass;

+ /** The log. */
final Log log = LogFactory
.getLog(getClass());

=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/InvocationInOutjectionMethodInterceptor.java
Wed May 20 00:20:35 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/InvocationInOutjectionMethodInterceptor.java
Tue Aug 4 17:37:58 2009
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;

import org.aopalliance.intercept.MethodInterceptor;
@@ -191,7 +192,7 @@
public Object invoke(MethodInvocation invocation) throws Throwable {

Object proxy = invocation.getThis();
- HashMap<Field, Object> map = new HashMap<Field, Object>();
+ Map<Field, Object> map = new HashMap<Field, Object>();
Method method = invocation.getMethod();
Definition defMethod = definition.getMemberDefinition(method);
Object result = null;
@@ -238,8 +239,8 @@
* @throws Throwable
* the throwable
*/
- private synchronized void releaseFlag(Object proxy,
- HashMap<Field, Object> map) throws Throwable {
+ private synchronized void releaseFlag(Object proxy, Map<Field, Object>
map)
+ throws Throwable {

this.flag--;
if (flag == 0) {
@@ -274,7 +275,7 @@
* the throwable
*/
private synchronized void takeCurrentFlag(Object proxy,
- HashMap<Field, Object> map) throws Throwable {
+ Map<Field, Object> map) throws Throwable {

flag++;
if (flag == 1
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/ThrowsAdviceStackMethodInterceptor.java
Fri May 15 05:16:41 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/interceptor/ThrowsAdviceStackMethodInterceptor.java
Tue Aug 4 17:37:58 2009
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
@@ -47,19 +48,19 @@
class ThrowsAdviceStackMethodInterceptor implements MethodInterceptor {
/** The advice map. */
@SuppressWarnings("unchecked")
- HashMap<Class<? extends Throwable>, ThrowsAdvice> adviceMap = new
HashMap<Class<? extends Throwable>, ThrowsAdvice>();
+ Map<Class<? extends Throwable>, ThrowsAdvice> adviceMap = new
HashMap<Class<? extends Throwable>, ThrowsAdvice>();

/** The throws advices. */
- ArrayList<ThrowsAdvice<Throwable>> throwsAdvices = new
ArrayList<ThrowsAdvice<Throwable>>();
+ List<ThrowsAdvice<Throwable>> throwsAdvices = new
ArrayList<ThrowsAdvice<Throwable>>();

/** The provider. */
- final Provider provider;
+ final Provider provider;

/** The runtime loading. */
- private boolean runtimeLoading = false;
+ private boolean runtimeLoading = false;

/** The definition. */
- Definition definition;
+ Definition definition;

/**
* Instantiates a new throws advice stack method interceptor.
@@ -134,7 +135,7 @@
public void addThrowsAdvice(ThrowsAdvice<?> advice)
throws ClassNotFoundException {

- ArrayList<Type> typeList = ReflectUtils.getAllGenericInterfaces(advice
+ List<Type> typeList = ReflectUtils.getAllGenericInterfaces(advice
.getClass(), true);
for (Type type : typeList) {
if (ReflectUtils.isCast(ParameterizedType.class, type)) {
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/metadata/AnnoMeta.java
Sun Jul 26 11:58:11 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/metadata/AnnoMeta.java
Tue Aug 4 17:37:58 2009
@@ -24,15 +24,15 @@
import org.aopalliance.reflect.Metadata;

/**
- * Represents {@link AnnoMeta annometa} is created in JGentle system. An
- * {@link AnnoMeta annometa} will have a holding list of {@link Metadata
- * metadatas} which may be another {@link AnnoMeta annometas} or also may
be
- * basic datas (values of attributes of an annotation) which is
interpreted.
+ * Represents the {@link AnnoMeta annotation metadata} will be created in
+ * JGentle system. An {@link AnnoMeta annotation metadata} will hold a
list of
+ * {@link Metadata metadatas} which may be another {@link AnnoMeta
annotation
+ * metadatas} or basic datas (values of attributes of an annotation) are
+ * interpreted.
* <p>
- * If {@link AnnoMeta annometa} is interpreted of annotation, key of
- * {@link AnnoMeta} will be the instance which is annotated with that
- * <code>annotation</code>, and value of {@link AnnoMeta annometa} will be
the
- * <code>annotation instance</code>.
+ * If {@link AnnoMeta annotation metadata} is interpreted of annotation,
key of
+ * it will be the instance which is annotated with that
<code>annotation</code>,
+ * and value will be the <code>annotation instance</code>.
*
* @author LE QUOC CHUNG - mailto: <a
* href="mailto:skydu...@yahoo.com">skydu...@yahoo.com</a>
@@ -41,64 +41,67 @@
*/
public interface AnnoMeta extends Metadata {
/**
- * Removes all the {@link Metadata}s in this {@link AnnoMeta}
+ * Removes all the {@link Metadata metadatas} in current {@link AnnoMeta
+ * annotation metadata}
*/
public void clear();

/**
- * Returns {@link AnnoMeta} if this {@link AnnoMeta} contains a specified
- * {@link Metadata}
+ * Returns <code>true</code> if current {@link AnnoMeta annotation
metadata}
+ * contains the given {@link Metadata metadata}
*
* @param metadata
* the desired {@link Metadata} need to be tested.
- * @return returns <b>true</b> if this {@link AnnoMeta} contains specified
- * {@link Metadata}, <b>false</b> otherwise.
+ * @return returns <b>true</b> if this {@link AnnoMeta annotation
metadata}
+ * contains the given {@link Metadata}, <b>false</b> otherwise.
*/
public boolean contains(Metadata metadata);

/**
- * Returns <b>true</b> if this {@link AnnoMeta} contains a {@link
Metadata}
- * for specified key.
+ * Returns <b>true</b> if this {@link AnnoMeta annotation metadata}
contains
+ * a {@link Metadata metadata} corresponds to the given object key.
*
* @param key
* key of {@link Metadata} need to be tested.
- * @return returns <b>true</b> if this {@link AnnoMeta} contains a
- * {@link Metadata} for specified key, <b>false</b> otherwise.
+ * @return returns <b>true</b> if this {@link AnnoMeta annotation
metadata}
+ * contains a {@link Metadata metadata} corresponds to the given
+ * key, <b>false</b> otherwise.
*/
public boolean contains(Object key);

/**
- * Returns the number of {@link Metadata} in this {@link AnnoMeta}
+ * Returns the number of all {@link Metadata metadatas} in current
+ * {@link AnnoMeta annotation metadata}
*/
public int count();

/**
- * Returns the {@link Metadata} to which the specified key is mapped, or
- * null if this {@link AnnoMeta} contains no mapping for the key.
+ * Returns the {@link Metadata metadata} corresponds to the given object
+ * key, or <code>null</code> if current {@link AnnoMeta annotation
metadata}
+ * doesn't contain any mapping corresponding to the given key.
*
* @param key
- * object key
- * @return {@link Metadata}
+ * the given object key
*/
public Metadata getMetadata(Object key);

/**
- * Returns the list of {@link Metadata}s in this {@link AnnoMeta}
+ * Returns the {@link Map map} containing all {@link Metadata metadatas}
in
+ * current {@link AnnoMeta annotation metadata}
*/
public Map<Object, Metadata> getMetaList();

/**
- * Returns the name of this {@link AnnoMeta}, if it is not specified, an
- * default name is name of object class of {@link AnnoMeta} will be
- * specified.
- *
- * @return String
+ * Returns the name of this {@link AnnoMeta annotation metadata}, if it's
+ * not specified, a default name is name of object class of {@link
AnnoMeta
+ * annotation metadata} will be returned.
*/
public String getName();

/**
- * Returns the parents of current {@link AnnoMeta}, if returned value is
- * <b>null</b>, this {@link AnnoMeta} is key of one {@link Definition}.
+ * Returns the parents of current {@link AnnoMeta annotation metadata}, if
+ * returning value is <b>null</b>, it will be key of one {@link Definition
+ * definition}.
*
* @see Definition
* @see DefinitionCore
@@ -106,51 +109,51 @@
public AnnoMeta getParents();

/**
- * Returns the class type of current {@link AnnoMeta}
+ * Returns the object class type of current {@link AnnoMeta annotation
+ * metadata}
*/
public Class<?> getType();

/**
- * Returns <b>true</b> if this {@link AnnoMeta} is empty, otherwise
returns
- * <b>false</b>.
+ * Returns <b>true</b> if current {@link AnnoMeta annotation metadata} is
+ * empty, otherwise returns <b>false</b>.
*/
public boolean isEmpty();

/**
- * Returns a {@link Set} of keys of {@link Metadata}s in this
- * {@link AnnoMeta}
+ * Returns a {@link Set set} of keys corresponds to all {@link Metadata
+ * metadatas} existing in current {@link AnnoMeta annotation metadata}
*/
public Set<Object> keySet();

/**
- * Puts a {@link Metadata} into current {@link AnnoMeta}.
+ * Puts a {@link Metadata metadata} into current {@link AnnoMeta
annotation
+ * metadata}.
*
* @param data
- * desired metadata.
- * @return {@link Metadata}
+ * the given metadata.
*/
public Metadata putMetaData(Metadata data);

/**
- * Removes a specified {@link Metadata}
+ * Removes a specified {@link Metadata metadata}
*
* @param key
- * key of {@link Metadata} need to be remove.
- * @return {@link Metadata}
+ * key of {@link Metadata} need to be removed.
*/
public Metadata removeMetadata(Object key);

/**
- * Sets the name.
+ * Sets name to current {@link AnnoMeta annotation metadata}.
*
* @param name
- * the name
+ * the given name
*/
public void setName(String name);

/**
- * Returns a {@link Collection} view of the {@link Metadata}s contained in
- * this {@link AnnoMeta}.
+ * Returns a {@link Collection collection} view of {@link Metadata
+ * metadatas} existing in current {@link AnnoMeta annotation metadata}.
*
* @return {@link Collection}
*/
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/metadata/DefinitionCore.java
Thu Jul 30 17:59:31 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/core/reflection/metadata/DefinitionCore.java
Tue Aug 4 17:37:58 2009
@@ -34,7 +34,7 @@
*/
public interface DefinitionCore extends MetadataControl {
/**
- * Create {@link AnnoMeta annotation metadata} content.
+ * Creates {@link AnnoMeta annotation metadata} content.
*/
public void buildAnnoMeta();

=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/services/objectpooling/AbstractBaseController.java
Sun Aug 2 17:54:16 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/services/objectpooling/AbstractBaseController.java
Tue Aug 4 17:37:58 2009
@@ -18,9 +18,14 @@
package org.jgentleframework.services.objectpooling;

import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
import java.util.List;
import java.util.TooManyListenersException;

+import net.sf.cglib.reflect.FastClass;
+import net.sf.cglib.reflect.FastMethod;
+
import org.jgentleframework.context.beans.Disposable;
import org.jgentleframework.context.beans.Initializing;
import org.jgentleframework.context.beans.ProviderAware;
@@ -53,25 +58,25 @@
public abstract class AbstractBaseController extends AbstractBasePooling
implements ProviderAware {
/** The num active. */
- protected int numActive = 0;
+ protected int numActive = 0;

/** The current {@link Provider}. */
- protected Provider provider = null;
+ protected Provider provider = null;

/** The init method lst. */
- protected List<Method> initMethodLst = null;
+ protected List<FastMethod> initMethodLst = null;

/** The can be pooled method lst. */
- protected List<Method> canBePooledMethodLst = null;
+ protected List<FastMethod> canBePooledMethodLst = null;

/** The deactivate method lst. */
- protected List<Method> deactivateMethodLst = null;
+ protected List<FastMethod> deactivateMethodLst = null;

/** The disposable method lst. */
- protected List<Method> disposableMethodLst = null;
+ protected List<FastMethod> disposableMethodLst = null;

/** The validate method lst. */
- protected List<Method> validateMethodLst = null;
+ protected List<FastMethod> validateMethodLst = null;

/*
* (non-Javadoc)
@@ -86,43 +91,104 @@
// Find activate methods
if (this.definition
.isAnnotationPresentAtAnyMethods(InitializingMethod.class)) {
- this.initMethodLst = this.definition
+ List<Method> methodList = this.definition
.getMethodsAnnotatedWith(InitializingMethod.class);
+ for (Method method : methodList) {
+ if (!Modifier.isPublic(method.getModifiers())) {
+ if (log.isErrorEnabled()) {
+ log.error("The initializing method [" + method
+ + "] must be public !!",
+ new UnsupportedOperationException());
+ }
+ }
+ FastClass fclass = FastClass.create(method.getDeclaringClass());
+ FastMethod fmethod = fclass.getMethod(method);
+ if (this.initMethodLst == null)
+ this.initMethodLst = new ArrayList<FastMethod>();
+ this.initMethodLst.add(fmethod);
+ }
}
// Find canBePooled methods
if (this.definition
.isAnnotationPresentAtAnyMethods(CanBePooledMethod.class)) {
- this.canBePooledMethodLst = this.definition
+ List<Method> methodList = this.definition
.getMethodsAnnotatedWith(CanBePooledMethod.class);
- for (Method method : canBePooledMethodLst) {
+ for (Method method : methodList) {
+ if (!Modifier.isPublic(method.getModifiers())) {
+ if (log.isErrorEnabled()) {
+ log.error("The CanBePooled method [" + method
+ + "] must be public !!",
+ new UnsupportedOperationException());
+ }
+ }
if (method.getReturnType() != Boolean.class
&& method.getReturnType() != boolean.class) {
if (log.isErrorEnabled()) {
- log.error("The 'return type' of canBePooled method ["
+ log.error("The 'return type' of CanBePooled method ["
+ method + "] must be boolean !!",
new UnsupportedOperationException());
}
}
+ FastClass fclass = FastClass.create(method.getDeclaringClass());
+ FastMethod fmethod = fclass.getMethod(method);
+ if (this.canBePooledMethodLst == null)
+ this.canBePooledMethodLst = new ArrayList<FastMethod>();
+ this.canBePooledMethodLst.add(fmethod);
}
}
// Find deactivate methods
if (this.definition
.isAnnotationPresentAtAnyMethods(DeactivateMethod.class)) {
- this.deactivateMethodLst = this.definition
+ List<Method> methodList = this.definition
.getMethodsAnnotatedWith(DeactivateMethod.class);
+ for (Method method : methodList) {
+ if (!Modifier.isPublic(method.getModifiers())) {
+ if (log.isErrorEnabled()) {
+ log.error("The deactivate method [" + method
+ + "] must be public !!",
+ new UnsupportedOperationException());
+ }
+ }
+ FastClass fclass = FastClass.create(method.getDeclaringClass());
+ FastMethod fmethod = fclass.getMethod(method);
+ if (this.deactivateMethodLst == null)
+ this.deactivateMethodLst = new ArrayList<FastMethod>();
+ this.deactivateMethodLst.add(fmethod);
+ }
}
// Find disposable methods
if (this.definition
.isAnnotationPresentAtAnyMethods(DisposableMethod.class)) {
- this.disposableMethodLst = this.definition
+ List<Method> methodList = this.definition
.getMethodsAnnotatedWith(DisposableMethod.class);
+ for (Method method : methodList) {
+ if (!Modifier.isPublic(method.getModifiers())) {
+ if (log.isErrorEnabled()) {
+ log.error("The disposable method [" + method
+ + "] must be public !!",
+ new UnsupportedOperationException());
+ }
+ }
+ FastClass fclass = FastClass.create(method.getDeclaringClass());
+ FastMethod fmethod = fclass.getMethod(method);
+ if (this.disposableMethodLst == null)
+ this.disposableMethodLst = new ArrayList<FastMethod>();
+ this.disposableMethodLst.add(fmethod);
+ }
}
// Find validate methods
if (this.definition
.isAnnotationPresentAtAnyMethods(ValidateMethod.class)) {
- this.validateMethodLst = this.definition
+ List<Method> methodList = this.definition
.getMethodsAnnotatedWith(ValidateMethod.class);
- for (Method method : validateMethodLst) {
+ for (Method method : methodList) {
+ if (!Modifier.isPublic(method.getModifiers())) {
+ if (log.isErrorEnabled()) {
+ log.error("The validate method [" + method
+ + "] must be public !!",
+ new UnsupportedOperationException());
+ }
+ }
if (method.getReturnType() != Boolean.class
&& method.getReturnType() != boolean.class) {
if (log.isErrorEnabled()) {
@@ -131,6 +197,11 @@
new UnsupportedOperationException());
}
}
+ FastClass fclass = FastClass.create(method.getDeclaringClass());
+ FastMethod fmethod = fclass.getMethod(method);
+ if (this.validateMethodLst == null)
+ this.validateMethodLst = new ArrayList<FastMethod>();
+ this.validateMethodLst.add(fmethod);
}
}
}
@@ -149,9 +220,8 @@
if (ReflectUtils.isCast(Initializing.class, obj))
((Initializing) obj).activate();
else if (this.initMethodLst != null) {
- for (Method method : initMethodLst) {
- method.setAccessible(true);
- method.invoke(obj);
+ for (FastMethod method : initMethodLst) {
+ method.invoke(obj, null);
}
}
}
@@ -175,9 +245,8 @@
return ((CanBePooled) obj).canBePooled();
}
else if (this.canBePooledMethodLst != null) {
- for (Method method : canBePooledMethodLst) {
- method.setAccessible(true);
- return (Boolean) method.invoke(obj);
+ for (FastMethod method : canBePooledMethodLst) {
+ return (Boolean) method.invoke(obj, null);
}
}
}
@@ -274,9 +343,8 @@
((Deactivate) obj).deactivate();
}
else if (this.deactivateMethodLst != null) {
- for (Method method : deactivateMethodLst) {
- method.setAccessible(true);
- method.invoke(obj);
+ for (FastMethod method : deactivateMethodLst) {
+ method.invoke(obj, null);
}
}
}
@@ -293,8 +361,7 @@

/*
* (non-Javadoc)
- * @see
- * org.jgentleframework.services.objectpooling.Pool#invalidateObject
+ * @see org.jgentleframework.services.objectpooling.Pool#invalidateObject
* (java.lang.Object)
*/
@Override
@@ -326,9 +393,8 @@
if (ReflectUtils.isCast(Disposable.class, obj))
((Disposable) obj).destroy();
else if (this.disposableMethodLst != null) {
- for (Method method : disposableMethodLst) {
- method.setAccessible(true);
- method.invoke(obj);
+ for (FastMethod method : disposableMethodLst) {
+ method.invoke(obj, null);
}
}
}
@@ -359,9 +425,8 @@
throw new Exception("Validate failed !!");
}
else if (this.validateMethodLst != null) {
- for (Method method : validateMethodLst) {
- method.setAccessible(true);
- if (!(Boolean) method.invoke(obj))
+ for (FastMethod method : validateMethodLst) {
+ if (!(Boolean) method.invoke(obj, null))
throw new Exception("Validate failed !!");
}
}
=======================================
---
/trunk/JGentleProject/src/org/jgentleframework/services/objectpooling/CommonPool.java
Sun Aug 2 17:54:16 2009
+++
/trunk/JGentleProject/src/org/jgentleframework/services/objectpooling/CommonPool.java
Tue Aug 4 17:37:58 2009
@@ -90,7 +90,7 @@
public Object obtainObject() throws NoSuchElementException, Throwable {

long starttime = System.currentTimeMillis();
- for (;;) {
+ while (true) {
TimestampObjectBean<Object> pair = null;
synchronized (this) {
assertDisable();
Reply all
Reply to author
Forward
0 new messages