Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheRestore.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
package org.apache.jcs.auxiliary.lateral;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.commons.logging.Log;
@@ -26,7 +29,7 @@
/**
* Used to repair the lateral caches managed by the associated instance of
* LateralCacheManager.
- *
+ *
*/
public class LateralCacheRestore
implements ICacheRestore
@@ -41,7 +44,7 @@
/**
* Constructs with the given instance of LateralCacheManager.
- *
+ *
* @param lcm
*/
public LateralCacheRestore( ILateralCacheManager lcm )
@@ -52,7 +55,7 @@
/**
* Returns true iff the connection to the lateral host for the corresponding
* cache manager can be successfully re-established.
- *
+ *
* @return whether or not the cache can be fixed.
*/
public boolean canFix()
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheWatchRepairable.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
package org.apache.jcs.auxiliary.lateral;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
@@ -22,7 +25,7 @@
/**
* Same as CacheWatcherWrapper but implements the IRemoteCacheWatch interface.
- *
+ *
*/
public class LateralCacheWatchRepairable
extends CacheWatchRepairable
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java Thu May 10 09:03:42 2007
@@ -1,14 +1,22 @@
package org.apache.jcs.auxiliary.lateral;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
- * License, Version 2.0 (the "License") you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.Serializable;
@@ -72,7 +80,7 @@
{
this.ce = ce;
}
-
+
/**
* @return String, all the important values that can be configured
*/
@@ -84,5 +92,5 @@
buf.append( "\n valHashCode = [" + this.valHashCode + "]" );
buf.append( "\n ICacheElement = [" + this.ce + "]" );
return buf.toString();
- }
+ }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheService.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
package org.apache.jcs.auxiliary.lateral;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.Serializable;
@@ -28,7 +31,7 @@
* The ZombieLateralCacheService is used as a facade when the lateral is not
* available. It balks when the lateral is in error. When lateral service is
* restored, this is replaced by a live facade.
- *
+ *
*/
public class ZombieLateralCacheService
extends ZombieCacheService
@@ -37,7 +40,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService#update(org.apache.jcs.engine.behavior.ICacheElement,
* long)
*/
@@ -48,7 +51,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService#remove(java.lang.String,
* java.io.Serializable, long)
*/
@@ -59,7 +62,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService#removeAll(java.lang.String,
* long)
*/
@@ -70,7 +73,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService#getGroupKeys(java.lang.String,
* java.lang.String)
*/
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/ZombieLateralCacheWatch.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
package org.apache.jcs.auxiliary.lateral;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
@@ -22,7 +25,7 @@
/**
* Description of the Class
- *
+ *
*/
public class ZombieLateralCacheWatch
extends ZombieCacheWatch
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
package org.apache.jcs.auxiliary.lateral.behavior;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.Serializable;
@@ -22,12 +25,12 @@
/**
* This interface defines configuration options common to lateral cache
- * plugins.
+ * plugins.
* <p>
* TODO it needs to be trimmed down. The old version had features for
* every lateral. Now, the individual laterals have their own specific
* attributes interfaces.
- *
+ *
*/
public interface ILateralCacheAttributes
extends Serializable, AuxiliaryCacheAttributes
@@ -73,7 +76,7 @@
*/
public String getHttpServer();
-
+
/**
* Sets the httpListenerPort attribute of the ILateralCacheAttributes object
* <p>
@@ -182,15 +185,15 @@
public boolean getPutOnlyMode();
/**
- *
+ *
* @return String The Javagroups channel propeties.
*/
public String getJGChannelProperties();
/**
- *
+ *
* Sets the Javagroups channel propeties.
- *
+ *
* @param channelProperties
* String
*/
@@ -212,10 +215,10 @@
* a region R1 that is not configured for the lateral but another is. And if
* cache B has region R1 configured for lateral distribution, A will get
* messages for R1 but not send them.
- *
+ *
* @return true if we should have a listener conenction
*/
public boolean isReceive();
-
+
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheListener.java Thu May 10 09:03:42 2007
@@ -1,14 +1,22 @@
package org.apache.jcs.auxiliary.lateral.behavior;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
- * License, Version 2.0 (the "License") you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.jcs.engine.behavior.ICacheListener;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheManager.java Thu May 10 09:03:42 2007
@@ -1,59 +1,67 @@
-package org.apache.jcs.auxiliary.lateral.behavior;
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
- * License, Version 2.0 (the "License") you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
-
-/**
- * This helps ensure some common behvior among LateraLCacheManagers for things
- * such as montiors.
- * <p>
- * @author Aaron Smuts
- */
-public interface ILateralCacheManager
- extends AuxiliaryCacheManager
-{
- /**
- * This is a temporary solution that allos the monitor to get the instances
- * of a manager.
- * @return
- */
- public abstract Map getInstances();
-
- /**
- * This is a temporary solution that allos the monitor to get caches from an
- * instance of a manager.
- * @return
- */
- public abstract Map getCaches();
-
- /**
- * The restore calls thsi on the manger if a cache if found to be in error.
- * @return Object is the service if it can be fixed.
- * @throws IOException
- * if the service cannot be fixed.
- */
- public abstract Object fixService()
- throws IOException;
-
- /**
- * Sets the corected service. The restore process will call this if it gets
- * a good service back from fixService.
- * @param lateralService
- * @param lateralWatch
- */
- public void fixCaches( ILateralCacheService lateralService, ILateralCacheObserver lateralWatch );
-
-}
+package org.apache.jcs.auxiliary.lateral.behavior;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
+
+/**
+ * This helps ensure some common behvior among LateraLCacheManagers for things
+ * such as montiors.
+ * <p>
+ * @author Aaron Smuts
+ */
+public interface ILateralCacheManager
+ extends AuxiliaryCacheManager
+{
+ /**
+ * This is a temporary solution that allos the monitor to get the instances
+ * of a manager.
+ * @return
+ */
+ public abstract Map getInstances();
+
+ /**
+ * This is a temporary solution that allos the monitor to get caches from an
+ * instance of a manager.
+ * @return
+ */
+ public abstract Map getCaches();
+
+ /**
+ * The restore calls thsi on the manger if a cache if found to be in error.
+ * @return Object is the service if it can be fixed.
+ * @throws IOException
+ * if the service cannot be fixed.
+ */
+ public abstract Object fixService()
+ throws IOException;
+
+ /**
+ * Sets the corected service. The restore process will call this if it gets
+ * a good service back from fixService.
+ * @param lateralService
+ * @param lateralWatch
+ */
+ public void fixCaches( ILateralCacheService lateralService, ILateralCacheObserver lateralWatch );
+
+}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheObserver.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheObserver.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheObserver.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheObserver.java Thu May 10 09:03:42 2007
@@ -1,14 +1,22 @@
package org.apache.jcs.auxiliary.lateral.behavior;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
- * License, Version 2.0 (the "License") you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.jcs.engine.behavior.ICacheObserver;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheService.java Thu May 10 09:03:42 2007
@@ -1,14 +1,22 @@
package org.apache.jcs.auxiliary.lateral.behavior;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
- * License, Version 2.0 (the "License") you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.IOException;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/package.html
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/package.html?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/package.html (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/package.html Thu May 10 09:03:42 2007
@@ -1,8 +1,26 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<html>
<head>
</head>
<body>
- Root package for the lateral cache family. Lateral caches broadcast puts
+ Root package for the lateral cache family. Lateral caches broadcast puts
and removals to other local caches.
</body>
</html>
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Thu May 10 09:03:42 2007
@@ -1,176 +1,179 @@
-package org.apache.jcs.auxiliary.lateral.socket.tcp;
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
-import org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory;
-import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
-import org.apache.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryManager;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryService;
-import org.apache.jcs.engine.behavior.ICache;
-import org.apache.jcs.engine.behavior.ICompositeCacheManager;
-
-/**
- * Constructs a LateralCacheNoWaitFacade for the given configuration. Each
- * lateral service / local relationship is managed by one manager. This manager
- * can have multiple caches. The remote relationships are consolidated and
- * restored via these managers.
- * <p>
- * The facade provides a front to the composite cache so the implementation is
- * transparent.
- *
- */
-public class LateralTCPCacheFactory
- extends LateralCacheAbstractFactory
-{
- private final static Log log = LogFactory.getLog( LateralTCPCacheFactory.class );
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.auxiliary.AuxiliaryCacheFactory#createCache(org.apache.jcs.auxiliary.AuxiliaryCacheAttributes,
- * org.apache.jcs.engine.behavior.ICompositeCacheManager)
- */
- public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr )
- {
- ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
- ArrayList noWaits = new ArrayList();
-
- // pars up the tcp servers and set the tcpServer value and
- // get the manager and then get the cache
- // no servers are required.
- if ( lac.getTcpServers() != null )
- {
- StringTokenizer it = new StringTokenizer( lac.getTcpServers(), "," );
- if ( log.isDebugEnabled() )
- {
- log.debug( "Configured for [" + it.countTokens() + "] servers." );
- }
- while ( it.hasMoreElements() )
- {
- String server = (String) it.nextElement();
- if ( log.isDebugEnabled() )
- {
- log.debug( "tcp server = " + server );
- }
- ITCPLateralCacheAttributes lacC = (ITCPLateralCacheAttributes) lac.copy();
- lacC.setTcpServer( server );
- LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lacC, cacheMgr );
- ICache ic = lcm.getCache( lacC.getCacheName() );
- if ( ic != null )
- {
- noWaits.add( ic );
- }
- else
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "noWait is null, no lateral connection made" );
- }
- }
- }
- }
-
- createListener( (ILateralCacheAttributes) iaca, cacheMgr );
-
- // create the no wait facade.
- LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
- .toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes)iaca );
-
- // create udp discovery if available.
- createDiscoveryService( lac, lcnwf, cacheMgr );
-
- return lcnwf;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory#createListener(org.apache.jcs.auxiliary.lateral.LateralCacheAttributes,
- * org.apache.jcs.engine.behavior.ICompositeCacheManager)
- */
- public void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
- {
- ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes) lac;
- // don't create a listener if we are not receiving.
- if ( attr.isReceive() )
- {
- if ( log.isInfoEnabled() )
- {
- log.info( "Creating listener for " + lac );
- }
-
- try
- {
- // make a listener. if one doesn't exist
- LateralTCPListener.getInstance( attr, cacheMgr );
- }
- catch ( Exception e )
- {
- log.error( "Problem creating lateral listener", e );
- }
- }
- else
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "Not creating a listener since we are not receiving." );
- }
- }
- }
-
- /**
- * Creates the discovery service. Only creates this for tcp laterals right
- * now.
- *
- * @param lac
- * ITCPLateralCacheAttributes
- * @param lcnwf
- * @param cacheMgr
- * @return null if none is created.
- */
- private UDPDiscoveryService createDiscoveryService( ITCPLateralCacheAttributes lac, LateralCacheNoWaitFacade lcnwf,
- ICompositeCacheManager cacheMgr )
- {
- UDPDiscoveryService discovery = null;
-
- // create the UDP discovery for the TCP lateral
- if ( lac.isUdpDiscoveryEnabled() )
- {
- // need a factory for this so it doesn't
- // get dereferenced, also we don't want one for every region.
- discovery = UDPDiscoveryManager.getInstance().getService( lac, cacheMgr );
-
- discovery.addNoWaitFacade( lcnwf, lac.getCacheName() );
-
- if ( log.isInfoEnabled() )
- {
- log.info( "Created UDPDiscoveryService for TCP lateral cache." );
- }
- }
- return discovery;
- }
-}
+package org.apache.jcs.auxiliary.lateral.socket.tcp;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory;
+import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
+import org.apache.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryManager;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryService;
+import org.apache.jcs.engine.behavior.ICache;
+import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+
+/**
+ * Constructs a LateralCacheNoWaitFacade for the given configuration. Each
+ * lateral service / local relationship is managed by one manager. This manager
+ * can have multiple caches. The remote relationships are consolidated and
+ * restored via these managers.
+ * <p>
+ * The facade provides a front to the composite cache so the implementation is
+ * transparent.
+ *
+ */
+public class LateralTCPCacheFactory
+ extends LateralCacheAbstractFactory
+{
+ private final static Log log = LogFactory.getLog( LateralTCPCacheFactory.class );
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jcs.auxiliary.AuxiliaryCacheFactory#createCache(org.apache.jcs.auxiliary.AuxiliaryCacheAttributes,
+ * org.apache.jcs.engine.behavior.ICompositeCacheManager)
+ */
+ public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr )
+ {
+ ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
+ ArrayList noWaits = new ArrayList();
+
+ // pars up the tcp servers and set the tcpServer value and
+ // get the manager and then get the cache
+ // no servers are required.
+ if ( lac.getTcpServers() != null )
+ {
+ StringTokenizer it = new StringTokenizer( lac.getTcpServers(), "," );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Configured for [" + it.countTokens() + "] servers." );
+ }
+ while ( it.hasMoreElements() )
+ {
+ String server = (String) it.nextElement();
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "tcp server = " + server );
+ }
+ ITCPLateralCacheAttributes lacC = (ITCPLateralCacheAttributes) lac.copy();
+ lacC.setTcpServer( server );
+ LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lacC, cacheMgr );
+ ICache ic = lcm.getCache( lacC.getCacheName() );
+ if ( ic != null )
+ {
+ noWaits.add( ic );
+ }
+ else
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "noWait is null, no lateral connection made" );
+ }
+ }
+ }
+ }
+
+ createListener( (ILateralCacheAttributes) iaca, cacheMgr );
+
+ // create the no wait facade.
+ LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
+ .toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes)iaca );
+
+ // create udp discovery if available.
+ createDiscoveryService( lac, lcnwf, cacheMgr );
+
+ return lcnwf;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory#createListener(org.apache.jcs.auxiliary.lateral.LateralCacheAttributes,
+ * org.apache.jcs.engine.behavior.ICompositeCacheManager)
+ */
+ public void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
+ {
+ ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes) lac;
+ // don't create a listener if we are not receiving.
+ if ( attr.isReceive() )
+ {
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Creating listener for " + lac );
+ }
+
+ try
+ {
+ // make a listener. if one doesn't exist
+ LateralTCPListener.getInstance( attr, cacheMgr );
+ }
+ catch ( Exception e )
+ {
+ log.error( "Problem creating lateral listener", e );
+ }
+ }
+ else
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Not creating a listener since we are not receiving." );
+ }
+ }
+ }
+
+ /**
+ * Creates the discovery service. Only creates this for tcp laterals right
+ * now.
+ *
+ * @param lac
+ * ITCPLateralCacheAttributes
+ * @param lcnwf
+ * @param cacheMgr
+ * @return null if none is created.
+ */
+ private UDPDiscoveryService createDiscoveryService( ITCPLateralCacheAttributes lac, LateralCacheNoWaitFacade lcnwf,
+ ICompositeCacheManager cacheMgr )
+ {
+ UDPDiscoveryService discovery = null;
+
+ // create the UDP discovery for the TCP lateral
+ if ( lac.isUdpDiscoveryEnabled() )
+ {
+ // need a factory for this so it doesn't
+ // get dereferenced, also we don't want one for every region.
+ discovery = UDPDiscoveryManager.getInstance().getService( lac, cacheMgr );
+
+ discovery.addNoWaitFacade( lcnwf, lac.getCacheName() );
+
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Created UDPDiscoveryService for TCP lateral cache." );
+ }
+ }
+ return discovery;
+ }
+}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Thu May 10 09:03:42 2007
@@ -1,310 +1,313 @@
-package org.apache.jcs.auxiliary.lateral.socket.tcp;
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License")
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.lateral.LateralCache;
-import org.apache.jcs.auxiliary.lateral.LateralCacheAbstractManager;
-import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
-import org.apache.jcs.auxiliary.lateral.LateralCacheMonitor;
-import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
-import org.apache.jcs.auxiliary.lateral.LateralCacheWatchRepairable;
-import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheService;
-import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheWatch;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
-import org.apache.jcs.engine.behavior.ICompositeCacheManager;
-
-/**
- * Creates lateral caches. Lateral caches are primarily used for removing non
- * laterally configured caches. Non laterally configured cache regions should
- * still be able to participate in removal. But if there is a non laterally
- * configured cache hub, then lateral removals may be necessary. For flat
- * webserver production environments, without a strong machine at the app server
- * level, distribution and search may need to occur at the lateral cache level.
- * This is currently not implemented in the lateral cache.
- * <p>
- *
- * @TODO: - need freeCache, release, getStats - need to find an interface
- * acceptable for all - cache managers or a manager within a type
- */
-public class LateralTCPCacheManager
- extends LateralCacheAbstractManager
-{
- private static final long serialVersionUID = -9213011856644392480L;
-
- private final static Log log = LogFactory.getLog( LateralTCPCacheManager.class );
-
- private static LateralCacheMonitor monitor;
-
- /** Address to instance map. */
- protected static Map instances = new HashMap();
-
- /** ITCPLateralCacheAttributes */
- protected ITCPLateralCacheAttributes lca;
-
- private int clients;
-
- /**
- * Handle to the lateral cache service; or a zombie handle if failed to
- * connect.
- */
- private ILateralCacheService lateralService;
-
- /**
- * Wrapper of the lateral cache watch service; or wrapper of a zombie
- * service if failed to connect.
- */
- private LateralCacheWatchRepairable lateralWatch;
-
- /** This is set in the constructor. */
- private ICompositeCacheManager cacheMgr;
-
- /**
- * Returns an instance of the LateralCacheManager.
- * <p>
- * @param lca
- * @param cacheMgr
- * this allows the auxiliary to be passed a cache manager.
- * @return
- */
- public static LateralTCPCacheManager getInstance( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
- {
- LateralTCPCacheManager ins = (LateralTCPCacheManager) instances.get( lca.toString() );
- synchronized ( instances )
- {
- if ( ins == null )
- {
- log.info( "Instance for [" + lca.toString() + "] is null, creating" );
-
- ins = (LateralTCPCacheManager) instances.get( lca.toString() );
- if ( ins == null )
- {
- ins = new LateralTCPCacheManager( lca, cacheMgr );
- instances.put( lca.toString(), ins );
- }
- }
- createMonitor( ins );
- }
- ins.clients++;
-
- return ins;
- }
-
- /**
- * The monitor needs reference to one instance, actually just a type.
- * <p>
- * TODO refactor this.
- * <p>
- * @param instance
- */
- private static synchronized void createMonitor( ILateralCacheManager instance )
- {
- // only want one monitor per lateral type
- // Fires up the monitoring daemon.
- if ( monitor == null )
- {
- monitor = new LateralCacheMonitor( instance );
- // Should never be null
- if ( monitor != null )
- {
- Thread t = new Thread( monitor );
- t.setDaemon( true );
- t.start();
- }
- }
- }
-
- /**
- * Constructor for the LateralCacheManager object.
- * <p>
- * @param lcaA
- * @param cacheMgr
- */
- private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr )
- {
- this.lca = lcaA;
-
- this.cacheMgr = cacheMgr;
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "Creating lateral cache service, lca = " + this.lca );
- }
-
- // Create the service
- try
- {
- if ( log.isInfoEnabled() )
- {
- log.info( "Creating TCP service, lca = " + this.lca );
- }
- this.lateralService = new LateralTCPService( this.lca );
-
- if ( this.lateralService == null )
- {
- log.error( "No service created, must zombie" );
- throw new Exception( "No service created for lateral cache." );
- }
-
- this.lateralWatch = new LateralCacheWatchRepairable();
- this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
- }
- catch ( Exception ex )
- {
- // Failed to connect to the lateral server.
- // Configure this LateralCacheManager instance to use the
- // "zombie" services.
- log.error( "Failure, lateral instance will use zombie service", ex );
-
- this.lateralService = new ZombieLateralCacheService();
- this.lateralWatch = new LateralCacheWatchRepairable();
- this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
-
- // Notify the cache monitor about the error, and kick off
- // the recovery process.
- createMonitor( this );
- monitor.notifyError();
- }
- }
-
- /**
- * Adds the lateral cache listener to the underlying cache-watch service.
- * <p>
- * @param cacheName
- * The feature to be added to the LateralCacheListener attribute
- * @param listener
- * The feature to be added to the LateralCacheListener attribute
- * @exception IOException
- */
- public void addLateralCacheListener( String cacheName, ILateralCacheListener listener )
- throws IOException
- {
- synchronized ( this.caches )
- {
- this.lateralWatch.addCacheListener( cacheName, listener );
- }
- }
-
- /**
- * Called to access a precreated region or construct one with defaults.
- * Since all aux cache access goes through the manager, this will never be
- * called.
- * <p>
- * After getting the manager instance for a server, the factory gets a cache
- * for the region name it is constructing.
- * <p>
- * There should be one manager per server and one cache per region per
- * manager.
- * <p>
- * @return AuxiliaryCache
- * @param cacheName
- */
- public AuxiliaryCache getCache( String cacheName )
- {
- LateralCacheNoWait lateralNoWait = null;
- synchronized ( this.caches )
- {
- lateralNoWait = (LateralCacheNoWait) this.caches.get( cacheName );
- if ( lateralNoWait == null )
- {
- LateralCacheAttributes attr = (LateralCacheAttributes) lca.copy();
- attr.setCacheName( cacheName );
-
- LateralCache cache = new LateralCache( attr, this.lateralService, monitor );
- if ( log.isDebugEnabled() )
- {
- log.debug( "Created cache for noWait, cache [" + cache + "]" );
- }
- lateralNoWait = new LateralCacheNoWait( cache );
- this.caches.put( cacheName, lateralNoWait );
-
- if ( log.isInfoEnabled() )
- {
- log.info( "Created LateralCacheNoWait for [" + this.lca + "] LateralCacheNoWait = ["
- + lateralNoWait + "]" );
- }
- }
- }
-
- // don't create a listener if we are not receiving.
- if ( lca.isReceive() )
- {
- try
- {
- addLateralCacheListener( cacheName, LateralTCPListener.getInstance( this.lca, cacheMgr ) );
- }
- catch ( IOException ioe )
- {
- log.error( "Problem creating lateral listener", ioe );
- }
- catch ( Exception e )
- {
- log.error( "Problem creating lateral listener", e );
- }
- }
- else
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "Not creating a listener since we are not receiving." );
- }
- }
- // TODO: need listener repair
-
- return lateralNoWait;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractManager#getInstances()
- */
- public Map getInstances()
- {
- return instances;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager#fixService()
- */
- public Object fixService()
- throws IOException
- {
- Object service = null;
- try
- {
- service = new LateralTCPService( lca );
- }
- catch ( Exception ex )
- {
- log.error( "Can't fix " + ex.getMessage() );
- throw new IOException( "Can't fix " + ex.getMessage() );
- }
- return service;
- }
-}
+package org.apache.jcs.auxiliary.lateral.socket.tcp;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.lateral.LateralCache;
+import org.apache.jcs.auxiliary.lateral.LateralCacheAbstractManager;
+import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.LateralCacheMonitor;
+import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
+import org.apache.jcs.auxiliary.lateral.LateralCacheWatchRepairable;
+import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheService;
+import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheWatch;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
+import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+
+/**
+ * Creates lateral caches. Lateral caches are primarily used for removing non
+ * laterally configured caches. Non laterally configured cache regions should
+ * still be able to participate in removal. But if there is a non laterally
+ * configured cache hub, then lateral removals may be necessary. For flat
+ * webserver production environments, without a strong machine at the app server
+ * level, distribution and search may need to occur at the lateral cache level.
+ * This is currently not implemented in the lateral cache.
+ * <p>
+ *
+ * @TODO: - need freeCache, release, getStats - need to find an interface
+ * acceptable for all - cache managers or a manager within a type
+ */
+public class LateralTCPCacheManager
+ extends LateralCacheAbstractManager
+{
+ private static final long serialVersionUID = -9213011856644392480L;
+
+ private final static Log log = LogFactory.getLog( LateralTCPCacheManager.class );
+
+ private static LateralCacheMonitor monitor;
+
+ /** Address to instance map. */
+ protected static Map instances = new HashMap();
+
+ /** ITCPLateralCacheAttributes */
+ protected ITCPLateralCacheAttributes lca;
+
+ private int clients;
+
+ /**
+ * Handle to the lateral cache service; or a zombie handle if failed to
+ * connect.
+ */
+ private ILateralCacheService lateralService;
+
+ /**
+ * Wrapper of the lateral cache watch service; or wrapper of a zombie
+ * service if failed to connect.
+ */
+ private LateralCacheWatchRepairable lateralWatch;
+
+ /** This is set in the constructor. */
+ private ICompositeCacheManager cacheMgr;
+
+ /**
+ * Returns an instance of the LateralCacheManager.
+ * <p>
+ * @param lca
+ * @param cacheMgr
+ * this allows the auxiliary to be passed a cache manager.
+ * @return
+ */
+ public static LateralTCPCacheManager getInstance( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
+ {
+ LateralTCPCacheManager ins = (LateralTCPCacheManager) instances.get( lca.toString() );
+ synchronized ( instances )
+ {
+ if ( ins == null )
+ {
+ log.info( "Instance for [" + lca.toString() + "] is null, creating" );
+
+ ins = (LateralTCPCacheManager) instances.get( lca.toString() );
+ if ( ins == null )
+ {
+ ins = new LateralTCPCacheManager( lca, cacheMgr );
+ instances.put( lca.toString(), ins );
+ }
+ }
+ createMonitor( ins );
+ }
+ ins.clients++;
+
+ return ins;
+ }
+
+ /**
+ * The monitor needs reference to one instance, actually just a type.
+ * <p>
+ * TODO refactor this.
+ * <p>
+ * @param instance
+ */
+ private static synchronized void createMonitor( ILateralCacheManager instance )
+ {
+ // only want one monitor per lateral type
+ // Fires up the monitoring daemon.
+ if ( monitor == null )
+ {
+ monitor = new LateralCacheMonitor( instance );
+ // Should never be null
+ if ( monitor != null )
+ {
+ Thread t = new Thread( monitor );
+ t.setDaemon( true );
+ t.start();
+ }
+ }
+ }
+
+ /**
+ * Constructor for the LateralCacheManager object.
+ * <p>
+ * @param lcaA
+ * @param cacheMgr
+ */
+ private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr )
+ {
+ this.lca = lcaA;
+
+ this.cacheMgr = cacheMgr;
+
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Creating lateral cache service, lca = " + this.lca );
+ }
+
+ // Create the service
+ try
+ {
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Creating TCP service, lca = " + this.lca );
+ }
+ this.lateralService = new LateralTCPService( this.lca );
+
+ if ( this.lateralService == null )
+ {
+ log.error( "No service created, must zombie" );
+ throw new Exception( "No service created for lateral cache." );
+ }
+
+ this.lateralWatch = new LateralCacheWatchRepairable();
+ this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
+ }
+ catch ( Exception ex )
+ {
+ // Failed to connect to the lateral server.
+ // Configure this LateralCacheManager instance to use the
+ // "zombie" services.
+ log.error( "Failure, lateral instance will use zombie service", ex );
+
+ this.lateralService = new ZombieLateralCacheService();
+ this.lateralWatch = new LateralCacheWatchRepairable();
+ this.lateralWatch.setCacheWatch( new ZombieLateralCacheWatch() );
+
+ // Notify the cache monitor about the error, and kick off
+ // the recovery process.
+ createMonitor( this );
+ monitor.notifyError();
+ }
+ }
+
+ /**
+ * Adds the lateral cache listener to the underlying cache-watch service.
+ * <p>
+ * @param cacheName
+ * The feature to be added to the LateralCacheListener attribute
+ * @param listener
+ * The feature to be added to the LateralCacheListener attribute
+ * @exception IOException
+ */
+ public void addLateralCacheListener( String cacheName, ILateralCacheListener listener )
+ throws IOException
+ {
+ synchronized ( this.caches )
+ {
+ this.lateralWatch.addCacheListener( cacheName, listener );
+ }
+ }
+
+ /**
+ * Called to access a precreated region or construct one with defaults.
+ * Since all aux cache access goes through the manager, this will never be
+ * called.
+ * <p>
+ * After getting the manager instance for a server, the factory gets a cache
+ * for the region name it is constructing.
+ * <p>
+ * There should be one manager per server and one cache per region per
+ * manager.
+ * <p>
+ * @return AuxiliaryCache
+ * @param cacheName
+ */
+ public AuxiliaryCache getCache( String cacheName )
+ {
+ LateralCacheNoWait lateralNoWait = null;
+ synchronized ( this.caches )
+ {
+ lateralNoWait = (LateralCacheNoWait) this.caches.get( cacheName );
+ if ( lateralNoWait == null )
+ {
+ LateralCacheAttributes attr = (LateralCacheAttributes) lca.copy();
+ attr.setCacheName( cacheName );
+
+ LateralCache cache = new LateralCache( attr, this.lateralService, monitor );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Created cache for noWait, cache [" + cache + "]" );
+ }
+ lateralNoWait = new LateralCacheNoWait( cache );
+ this.caches.put( cacheName, lateralNoWait );
+
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Created LateralCacheNoWait for [" + this.lca + "] LateralCacheNoWait = ["
+ + lateralNoWait + "]" );
+ }
+ }
+ }
+
+ // don't create a listener if we are not receiving.
+ if ( lca.isReceive() )
+ {
+ try
+ {
+ addLateralCacheListener( cacheName, LateralTCPListener.getInstance( this.lca, cacheMgr ) );
+ }
+ catch ( IOException ioe )
+ {
+ log.error( "Problem creating lateral listener", ioe );
+ }
+ catch ( Exception e )
+ {
+ log.error( "Problem creating lateral listener", e );
+ }
+ }
+ else
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Not creating a listener since we are not receiving." );
+ }
+ }
+ // TODO: need listener repair
+
+ return lateralNoWait;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractManager#getInstances()
+ */
+ public Map getInstances()
+ {
+ return instances;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager#fixService()
+ */
+ public Object fixService()
+ throws IOException
+ {
+ Object service = null;
+ try
+ {
+ service = new LateralTCPService( lca );
+ }
+ catch ( Exception ex )
+ {
+ log.error( "Can't fix " + ex.getMessage() );
+ throw new IOException( "Can't fix " + ex.getMessage() );
+ }
+ return service;
+ }
+}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Thu May 10 09:03:42 2007
@@ -1,14 +1,22 @@
package org.apache.jcs.auxiliary.lateral.socket.tcp;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
- * License, Version 2.0 (the "License") you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.IOException;
@@ -246,7 +254,7 @@
*/
public void handleRemoveAll( String cacheName )
throws IOException
- {
+ {
if ( log.isDebugEnabled() )
{
log.debug( "handleRemoveAll> cacheName=" + cacheName );
@@ -276,7 +284,7 @@
+ getGetCnt() );
}
}
-
+
if ( log.isDebugEnabled() )
{
log.debug( "handleGet> cacheName=" + cacheName + ", key = " + key );
@@ -353,7 +361,7 @@
{
return removeCnt;
}
-
+
/**
* @param cacheMgr
* The cacheMgr to set.
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java Thu May 10 09:03:42 2007
@@ -1,12 +1,22 @@
package org.apache.jcs.auxiliary.lateral.socket.tcp;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache License, Version
- * 2.0 (the "License") you may not use this file except in compliance with the License. You may
- * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- * applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
- * the License for the specific language governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.BufferedReader;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Thu May 10 09:03:42 2007
@@ -1,12 +1,22 @@
package org.apache.jcs.auxiliary.lateral.socket.tcp;
/*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache License, Version
- * 2.0 (the "License") you may not use this file except in compliance with the License. You may
- * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- * applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
- * the License for the specific language governing permissions and limitations under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.BufferedReader;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.