You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by tv...@apache.org on 2007/05/10 18:04:27 UTC
svn commit: r536904 [6/38] - in /jakarta/jcs/trunk: ./
auxiliary-builds/javagroups/
auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/
auxiliary-builds/javagroups/src/test/org/apache/jcs/auxiliary/javagroups/
auxiliary-builds/jdk...
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileUtils.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileUtils.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileUtils.java Thu May 10 09:03:42 2007
@@ -1,22 +1,24 @@
+package org.apache.jcs.yajcache.file;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.file;
-
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
@@ -34,11 +36,11 @@
// http://www.netbeans.org/issues/show_bug.cgi?id=53704
public enum CacheFileUtils {
inst;
-
- /**
- * Creates the directory for the specified cache,
+
+ /**
+ * Creates the directory for the specified cache,
* including any necessary but nonexistent parent directories.
- * Note that if this operation fails it may have succeeded in
+ * Note that if this operation fails it may have succeeded in
* creating some of the necessary parent directories.
*
* @return true if succesfull; false otherwise.
@@ -53,7 +55,7 @@
*/
public boolean rmCacheDir(@NonNullable String cacheName) {
File dir = this.getCacheDir(cacheName);
-
+
if (!dir.exists())
return true;
for (File f : dir.listFiles()) {
@@ -63,7 +65,7 @@
}
public boolean isCacheDirEmpty(@NonNullable String cacheName) {
File dir = this.getCacheDir(cacheName);
-
+
if (!dir.exists())
return true;
String[] list = dir.list();
@@ -71,16 +73,16 @@
}
public int getCacheDirSize(@NonNullable String cacheName) {
File dir = this.getCacheDir(cacheName);
-
+
if (!dir.exists())
return 0;
String[] list = dir.list();
return list == null ? 0 : list.length;
}
- public String[] getCacheDirList(@NonNullable String cacheName)
+ public String[] getCacheDirList(@NonNullable String cacheName)
{
File dir = this.getCacheDir(cacheName);
-
+
if (!dir.exists())
return null;
return dir.list();
@@ -96,7 +98,7 @@
*/
@NonNullable File getCacheFile(
@NonNullable String cacheName,
- @NonNullable String key)
+ @NonNullable String key)
{
File dir = this.getCacheDir(cacheName);
return new File(dir, key);
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightApache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightApache.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightApache.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightApache.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightType.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightType.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightType.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/CopyRightType.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
/**
* Copyright Types.
@@ -27,7 +30,7 @@
APACHE {
@Override public String toString() {
return "\n"
- + "/* ========================================================================\n"
+ + "/* ========================================================================\n"
+ " * Copyright 2005 The Apache Software Foundation\n"
+ " *\n"
+ " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Immutable.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Immutable.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Immutable.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Immutable.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Implements.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Implements.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Implements.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/Implements.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-
-package org.apache.jcs.yajcache.lang.annotation;
/**
* Implements the specified interface.
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/JavaBean.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/JavaBean.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/JavaBean.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/JavaBean.java Thu May 10 09:03:42 2007
@@ -1,19 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
+
/*
- * Copyright 2005 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
@@ -27,8 +31,8 @@
@Inherited
@Retention(RetentionPolicy.SOURCE)
@Target({
- ElementType.TYPE, // return value of a method is a
- ElementType.METHOD, // return value of a method is a
+ ElementType.TYPE, // return value of a method is a
+ ElementType.METHOD, // return value of a method is a
ElementType.FIELD, // field is never null
ElementType.LOCAL_VARIABLE, // variable is never null
ElementType.PARAMETER // parameter is never null
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/NonNullable.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/NonNullable.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/NonNullable.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/NonNullable.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TODO.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TODO.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TODO.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TODO.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TestOnly.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TestOnly.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TestOnly.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/TestOnly.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafety.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafety.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafety.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafety.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafetyType.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafetyType.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafetyType.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/ThreadSafetyType.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.annotation;
/**
* Thread Safety Types.
@@ -27,38 +30,38 @@
// http://www.netbeans.org/issues/show_bug.cgi?id=53704
public enum ThreadSafetyType {
/** Immutable objects are guaranteed to be thread-safe. */
- IMMUTABLE,
+ IMMUTABLE,
/**
* Instances of this class are mutable, but all methods contain
- * sufficient internal synchronization that instances may be used
+ * sufficient internal synchronization that instances may be used
* concurrently without the need for external synchronization.
*/
- SAFE,
+ SAFE,
/**
- * Conditionally thread-safe classes are those for which each individual
- * operation may be thread-safe, but certain sequences of operations may
- * require external synchronization. The most common example of
- * conditional thread safety is traversing an iterator returned from
- * Hashtable or Vector -- the fail-fast iterators returned by these
- * classes assume that the underlying collection will not be mutated
- * while the iterator traversal is in progress. To ensure that other
- * threads will not mutate the collection during traversal, the
- * iterating thread should be sure that it has exclusive access to
- * the collection for the entirety of the traversal. Typically,
- * exclusive access is ensured by synchronizing on a lock -- and the
- * class's documentation should specify which lock that is
+ * Conditionally thread-safe classes are those for which each individual
+ * operation may be thread-safe, but certain sequences of operations may
+ * require external synchronization. The most common example of
+ * conditional thread safety is traversing an iterator returned from
+ * Hashtable or Vector -- the fail-fast iterators returned by these
+ * classes assume that the underlying collection will not be mutated
+ * while the iterator traversal is in progress. To ensure that other
+ * threads will not mutate the collection during traversal, the
+ * iterating thread should be sure that it has exclusive access to
+ * the collection for the entirety of the traversal. Typically,
+ * exclusive access is ensured by synchronizing on a lock -- and the
+ * class's documentation should specify which lock that is
* (typically the object's intrinsic monitor).
*/
- CONDITIONAL,
+ CONDITIONAL,
/**
- * Thread-compatible classes are not thread-safe, but can be used
- * safely in concurrent environments by using synchronization
+ * Thread-compatible classes are not thread-safe, but can be used
+ * safely in concurrent environments by using synchronization
* appropriately.
*/
- COMPATIBLE,
+ COMPATIBLE,
/**
- * Thread-hostile classes are those that cannot be rendered safe to
- * use concurrently, regardless of what external synchronization is
+ * Thread-hostile classes are those that cannot be rendered safe to
+ * use concurrently, regardless of what external synchronization is
* invoked.
*/
HOSTILE
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/UnsupportedOperation.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/UnsupportedOperation.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/UnsupportedOperation.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/annotation/UnsupportedOperation.java Thu May 10 09:03:42 2007
@@ -1,21 +1,23 @@
+package org.apache.jcs.yajcache.lang.annotation;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-
-package org.apache.jcs.yajcache.lang.annotation;
import java.lang.annotation.*;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/IKey.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/IKey.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/IKey.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/IKey.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.ref;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-
-package org.apache.jcs.yajcache.lang.ref;
import org.apache.jcs.yajcache.lang.annotation.*;
/**
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedRefCollector.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedRefCollector.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedRefCollector.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedRefCollector.java Thu May 10 09:03:42 2007
@@ -1,21 +1,24 @@
+package org.apache.jcs.yajcache.lang.ref;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.ref;
-
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.util.concurrent.ConcurrentMap;
@@ -27,8 +30,8 @@
import org.apache.jcs.yajcache.lang.annotation.*;
/**
- * Keyed Reference garbage collector which removes stale
- * Keyed {@link Reference} entries
+ * Keyed Reference garbage collector which removes stale
+ * Keyed {@link Reference} entries
* from the given {@link ConcurrentMap} using the embedded keys.
* The stale Keyed References are put into the given {@link ReferenceQueue}
* by the JVM garbage collector.
@@ -46,7 +49,7 @@
* Constructs with a given reference queue and concurrent map.
*/
public KeyedRefCollector(
- @NonNullable ReferenceQueue<?> q,
+ @NonNullable ReferenceQueue<?> q,
@NonNullable ConcurrentMap<K, ? extends IKey<K>> synMap)
{
this.q = q;
@@ -57,7 +60,7 @@
*/
public void run() {
Reference ref;
-
+
while ((ref = this.q.poll()) != null) {
IKey keyedRef = (IKey)ref;
// remove unused lock; may fail but that's fine.
@@ -65,7 +68,7 @@
// referent should have been cleared by GC.
if (debug)
this.count.incrementAndGet();
- }
+ }
}
public int getCount() {
return this.count.intValue();
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedSoftReference.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedSoftReference.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedSoftReference.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedSoftReference.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.lang.ref;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.ref;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
@@ -27,27 +30,27 @@
* @author Hanson Char
*/
@CopyRightApache
-public class KeyedSoftReference<K,T> extends SoftReference<T>
- implements IKey<K>
+public class KeyedSoftReference<K,T> extends SoftReference<T>
+ implements IKey<K>
{
/** The embedded key. */
private final @NonNullable @Immutable K key;
-
+
/**
- * Creates a new soft reference with an embedded key that refers to
+ * Creates a new soft reference with an embedded key that refers to
* the given object. The new
* reference is not registered with any queue.
*
* @param key the embedded key of the new soft reference
* @param referent object the new soft reference will refer to
*/
- public KeyedSoftReference(@NonNullable @Immutable K key, T referent)
+ public KeyedSoftReference(@NonNullable @Immutable K key, T referent)
{
super(referent);
this.key = key;
}
/**
- * Creates a new soft reference with an embedded key that refers to
+ * Creates a new soft reference with an embedded key that refers to
* the given object and is registered with the given queue.
*
* @param key the embedded key of the new soft reference
@@ -55,8 +58,8 @@
* @param q the queue with which the reference is to be registered,
* or <tt>null</tt> if registration is not required
*/
- public KeyedSoftReference(@NonNullable @Immutable K key, T referent,
- ReferenceQueue<? super T> q)
+ public KeyedSoftReference(@NonNullable @Immutable K key, T referent,
+ ReferenceQueue<? super T> q)
{
super(referent, q);
this.key = key;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedWeakReference.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedWeakReference.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedWeakReference.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/lang/ref/KeyedWeakReference.java Thu May 10 09:03:42 2007
@@ -1,21 +1,24 @@
+package org.apache.jcs.yajcache.lang.ref;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.lang.ref;
-
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
@@ -26,14 +29,14 @@
* @author Hanson Char
*/
@CopyRightApache
-public class KeyedWeakReference<K,T> extends WeakReference<T>
- implements IKey<K>
+public class KeyedWeakReference<K,T> extends WeakReference<T>
+ implements IKey<K>
{
/** The embedded key. */
public final @NonNullable @Immutable K key;
/**
- * Creates a new weak reference with an embedded key that refers to
+ * Creates a new weak reference with an embedded key that refers to
* the given object. The new
* reference is not registered with any queue.
*
@@ -45,7 +48,7 @@
this.key = key;
}
/**
- * Creates a new weak reference with an embedded key that refers to
+ * Creates a new weak reference with an embedded key that refers to
* the given object and is registered with the given queue.
*
* @param key the embedded key of the new weak reference
@@ -53,8 +56,8 @@
* @param q the queue with which the reference is to be registered,
* or <tt>null</tt> if registration is not required
*/
- public KeyedWeakReference(@NonNullable @Immutable K key, T referent,
- ReferenceQueue<? super T> q)
+ public KeyedWeakReference(@NonNullable @Immutable K key, T referent,
+ ReferenceQueue<? super T> q)
{
super(referent, q);
this.key = key;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCache.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCache.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCache.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.soft;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.soft;
import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;
@@ -61,7 +64,7 @@
private AtomicInteger countGetHitMemory = new AtomicInteger(0);
private AtomicInteger countGetMiss = new AtomicInteger(0);
private AtomicInteger countGetEmptyRef = new AtomicInteger(0);
-
+
private AtomicInteger countPut = new AtomicInteger(0);
private AtomicInteger countRemove = new AtomicInteger(0);
/** Returns the cache name. */
@@ -72,8 +75,8 @@
public @NonNullable Class<V> getValueType() {
return this.valueType;
}
- public SoftRefCache(@NonNullable String name, @NonNullable Class<V> valueType,
- int initialCapacity, float loadFactor, int concurrencyLevel)
+ public SoftRefCache(@NonNullable String name, @NonNullable Class<V> valueType,
+ int initialCapacity, float loadFactor, int concurrencyLevel)
{
this.map = CollectionUtils.inst.newConcurrentHashMap(initialCapacity, loadFactor, concurrencyLevel);
this.collector = new KeyedRefCollector<String>(refq, map);
@@ -81,9 +84,9 @@
this.valueType = valueType;
}
public SoftRefCache(
- @NonNullable String name,
- @NonNullable Class<V> valueType,
- int initialCapacity)
+ @NonNullable String name,
+ @NonNullable Class<V> valueType,
+ int initialCapacity)
{
this.map = CollectionUtils.inst.newConcurrentHashMap(initialCapacity);
this.collector = new KeyedRefCollector<String>(refq, map);
@@ -91,7 +94,7 @@
this.valueType = valueType;
}
public SoftRefCache(
- @NonNullable String name,
+ @NonNullable String name,
@NonNullable Class<V> valueType)
{
this.map = CollectionUtils.inst.newConcurrentHashMap();
@@ -115,14 +118,14 @@
this.countGet.incrementAndGet();
this.collector.run();
KeyedSoftReference<String,V> ref = map.get(key);
-
+
if (ref == null) {
if (debug)
this.countGetMiss.incrementAndGet();
return null;
}
V val = ref.get();
-
+
if (val == null) {
// Rarely gets here, if ever.
// already garbage collected. So try to clean up the key.
@@ -136,7 +139,7 @@
this.countGetHitMemory.incrementAndGet();
return val;
}
-
+
public V get(@NonNullable Object key) {
return key == null ? null : this.get(key.toString());
}
@@ -144,28 +147,28 @@
if (debug)
this.countPut.incrementAndGet();
this.collector.run();
- KeyedSoftReference<String,V> oldRef =
+ KeyedSoftReference<String,V> oldRef =
map.put(key, new KeyedSoftReference<String,V>(key, value, refq));
-
+
if (oldRef == null)
return null;
V ret = oldRef.get();
oldRef.clear();
-
+
if (!EqualsUtils.inst.equals(value, ret)) {
// value changed for the key
this.publishFlushKey(key);
}
return ret;
}
-
+
@TODO(
value="Queue up a flush event for the key.",
details="This is useful for synchronizing caches in a cluster environment."
)
private void publishFlushKey(@NonNullable String key) {
}
-
+
public void putAll(@NonNullable Map<? extends String, ? extends V> map) {
for (final Map.Entry<? extends String, ? extends V> e : map.entrySet())
this.put(e.getKey(), e.getValue());
@@ -175,7 +178,7 @@
this.countRemove.incrementAndGet();
this.collector.run();
KeyedSoftReference<String,V> oldRef = map.remove(key);
-
+
if (oldRef == null)
return null;
this.publishFlushKey(key);
@@ -198,11 +201,11 @@
this.collector.run();
Set<Map.Entry<String,KeyedSoftReference<String,V>>> fromSet = map.entrySet();
Set<Map.Entry<String,V>> toSet = new HashSet<Map.Entry<String,V>>();
-
+
for (final Map.Entry<String,KeyedSoftReference<String,V>> item : fromSet) {
KeyedSoftReference<String,V> ref = item.getValue();
V val = ref.get();
-
+
if (val != null) {
Map.Entry<String,V> e = new CacheEntry<V>(item.getKey(), val);
toSet.add(e);
@@ -214,10 +217,10 @@
this.collector.run();
Collection<KeyedSoftReference<String,V>> fromSet = map.values();
List<V> toCol = new ArrayList<V>(fromSet.size());
-
+
for (final KeyedSoftReference<String,V> ref : fromSet) {
V val = ref.get();
-
+
if (val != null) {
toCol.add(val);
}
@@ -232,10 +235,10 @@
public boolean containsValue(@NonNullable Object value) {
this.collector.run();
Collection<KeyedSoftReference<String,V>> fromSet = map.values();
-
+
for (final KeyedSoftReference<String,V> ref : fromSet) {
V val = ref.get();
-
+
if (EqualsUtils.inst.equals(value, val))
return true;
}
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefFileCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefFileCache.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefFileCache.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefFileCache.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.soft;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.soft;
import java.io.Serializable;
import java.lang.ref.ReferenceQueue;
@@ -64,7 +67,7 @@
*/
@CopyRightApache
@TODO("Annotate the thread-safetyness of the methods")
-public class SoftRefFileCache<V> implements ICache<V>
+public class SoftRefFileCache<V> implements ICache<V>
{
private static final boolean debug = true;
private Log log = debug ? LogFactory.getLog(this.getClass()) : null;
@@ -73,23 +76,23 @@
private final @NonNullable Class<V> valueType;
private final @NonNullable ConcurrentMap<String,KeyedSoftReference<String,V>> map;
private PerCacheConfig config;
-
+
private final @NonNullable KeyedRefCollector<String> collector;
private final IKeyedReadWriteLock<String> keyedRWLock = new KeyedReadWriteLock<String>();
-
- private final @NonNullable CacheChangeSupport<V> cacheChangeSupport =
+
+ private final @NonNullable CacheChangeSupport<V> cacheChangeSupport =
new CacheChangeSupport<V>(this);
-
+
private AtomicInteger countGet = new AtomicInteger(0);
-
+
private AtomicInteger countGetHitMemory = new AtomicInteger(0);
private AtomicInteger countGetHitFile = new AtomicInteger(0);
-
+
private AtomicInteger countGetMissMemory = new AtomicInteger(0);
private AtomicInteger countGetMiss = new AtomicInteger(0);
private AtomicInteger countGetCorruptedFile = new AtomicInteger(0);
private AtomicInteger countGetEmptyRef = new AtomicInteger(0);
-
+
private AtomicInteger countPut = new AtomicInteger(0);
private AtomicInteger countPutClearRef = new AtomicInteger(0);
private AtomicInteger countPutMissMemory = new AtomicInteger(0);
@@ -100,7 +103,7 @@
private AtomicInteger countPutWriteFile = new AtomicInteger(0);
private AtomicInteger countRemove = new AtomicInteger(0);
-
+
public @NonNullable String getName() {
return this.name;
}
@@ -109,7 +112,7 @@
}
public SoftRefFileCache(
@NonNullable String name, @NonNullable Class<V> valueType,
- int initialCapacity,float loadFactor, int concurrencyLevel)
+ int initialCapacity,float loadFactor, int concurrencyLevel)
{
this.map = CollectionUtils.inst.newConcurrentHashMap(initialCapacity, loadFactor, concurrencyLevel);
this.collector = new KeyedRefCollector<String>(refq, map);
@@ -119,7 +122,7 @@
}
public SoftRefFileCache(
@NonNullable String name, @NonNullable Class<V> valueType,
- int initialCapacity)
+ int initialCapacity)
{
this.map = CollectionUtils.inst.newConcurrentHashMap(initialCapacity);
this.collector = new KeyedRefCollector<String>(refq, map);
@@ -127,9 +130,9 @@
this.valueType = valueType;
CacheFileUtils.inst.mkCacheDirs(this.name);
}
-
+
public SoftRefFileCache(@NonNullable String name,
- @NonNullable Class<V> valueType)
+ @NonNullable Class<V> valueType)
{
this.map = CollectionUtils.inst.newConcurrentHashMap();
this.collector = new KeyedRefCollector<String>(refq, map);
@@ -170,7 +173,7 @@
cacheLock.unlock();
}
}
-
+
// @tothink: SoftReference.get() doesn't seem to be thread-safe.
// But do we really want to synchronize upon invoking get() ?
// It's not thread-safe, but what's the worst consequence ?
@@ -195,10 +198,10 @@
private V doGet(String key) {
KeyedSoftReference<String,V> ref = map.get(key);
V val = null;
-
+
if (ref != null) {
val = ref.get();
-
+
if (debug) {
if (val == null)
this.countGetEmptyRef.incrementAndGet();
@@ -209,14 +212,14 @@
this.countGetMissMemory.incrementAndGet();
}
if (val == null) {
- // Not in memory.
+ // Not in memory.
if (ref != null) {
// Rarely gets here, if ever.
// GC'd. So try to clean up the key/ref pair.
this.map.remove(key, ref);
}
CacheFileContent cfc = CacheFileDAO.inst.readCacheItem(this.name, key);
-
+
if (cfc == null) {
// Not in file system.
if (debug)
@@ -227,7 +230,7 @@
if (debug)
this.countGetHitFile.incrementAndGet();
val = (V)cfc.deserialize();
-
+
if (val == null) {
// Corrupted file. Try remove it from file system.
if (debug)
@@ -286,13 +289,13 @@
// }
// return;
// }
-
+
public V get(@NonNullable Object key) {
return this.get(key.toString());
}
public V put(@NonNullable String key, @NonNullable V value) {
this.collector.run();
-
+
if (debug)
this.countPut.incrementAndGet();
Lock cacheLock = CacheManager.inst.readLock(this);
@@ -313,11 +316,11 @@
KeyedSoftReference<String,V> oldRef =
map.put(key, new KeyedSoftReference<String,V>(key, value, refq));
V ret = null;
-
+
if (oldRef != null) {
ret = oldRef.get();
oldRef.clear();
-
+
if (debug)
this.countPutClearRef.incrementAndGet();
}
@@ -337,7 +340,7 @@
ret = (V)cfc.deserialize();
}
if (!EqualsUtils.inst.equals(value, ret)) {
- // Considered new value being put to memory.
+ // Considered new value being put to memory.
// So persist to file system.
if (debug) {
this.countPutNewFileValue.incrementAndGet();
@@ -376,14 +379,14 @@
)
private void publishFlushKey(@NonNullable String key) {
}
-
+
public void putAll(@NonNullable Map<? extends String, ? extends V> map) {
for (final Map.Entry<? extends String, ? extends V> e : map.entrySet())
this.put(e.getKey(), e.getValue());
}
public V remove(@NonNullable String key) {
this.collector.run();
-
+
if (debug)
this.countRemove.incrementAndGet();
Lock cacheLock = CacheManager.inst.readLock(this);
@@ -457,11 +460,11 @@
// this.collector.run();
Set<Map.Entry<String,KeyedSoftReference<String,V>>> fromSet = map.entrySet();
Set<Map.Entry<String,V>> toSet = new HashSet<Map.Entry<String,V>>();
-
+
for (final Map.Entry<String, KeyedSoftReference<String,V>> item : fromSet) {
KeyedSoftReference<String,V> ref = item.getValue();
V val = ref.get();
-
+
if (val != null) {
Map.Entry<String,V> e = new CacheEntry<V>(item.getKey(), val);
toSet.add(e);
@@ -476,10 +479,10 @@
public @NonNullable Collection<V> memoryValues() {
Collection<KeyedSoftReference<String,V>> fromSet = map.values();
List<V> toCol = new ArrayList<V>(fromSet.size());
-
+
for (final KeyedSoftReference<String,V> ref : fromSet) {
V val = ref.get();
-
+
if (val != null) {
toCol.add(val);
}
@@ -495,10 +498,10 @@
}
public boolean memoryContainsValue(@NonNullable Object value) {
Collection<KeyedSoftReference<String,V>> fromSet = map.values();
-
+
for (final KeyedSoftReference<String,V> ref : fromSet) {
V val = ref.get();
-
+
if (EqualsUtils.inst.equals(value, val))
return true;
}
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/BeanUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/BeanUtils.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/BeanUtils.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/BeanUtils.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.util;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.util;
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
@@ -34,7 +37,7 @@
inst;
private static final boolean debug = false;
private Log log = debug ? LogFactory.getLog(this.getClass()) : null;
-
+
public <B> B cloneDeep(B bean) {
if (bean == null
|| ClassUtils.inst.isImmutable(bean))
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/ClassUtils.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/ClassUtils.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/ClassUtils.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.util;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.util;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -28,8 +31,8 @@
// http://www.netbeans.org/issues/show_bug.cgi?id=53704
public enum ClassUtils {
inst;
- /**
- * Returns true if instances of the given class is known to be immutable;
+ /**
+ * Returns true if instances of the given class is known to be immutable;
* false if we don't know.
*/
public boolean isImmutable(@NonNullable Class t) {
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/CollectionUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/CollectionUtils.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/CollectionUtils.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/CollectionUtils.java Thu May 10 09:03:42 2007
@@ -1,22 +1,24 @@
+package org.apache.jcs.yajcache.util;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.util;
-
import java.util.concurrent.ConcurrentHashMap;
import org.apache.jcs.yajcache.lang.annotation.*;
@@ -29,14 +31,14 @@
@CopyRightApache
public enum CollectionUtils {
inst;
-
+
// Convenient methods originated from:
// http://www.artima.com/forums/flat.jsp?forum=106&thread=79394
-
+
public <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap() {
return new ConcurrentHashMap<K,V>();
}
- public <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap(int initialCapacity)
+ public <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap(int initialCapacity)
{
return new ConcurrentHashMap<K,V>(initialCapacity);
}
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/EqualsUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/EqualsUtils.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/EqualsUtils.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/EqualsUtils.java Thu May 10 09:03:42 2007
@@ -1,22 +1,24 @@
+package org.apache.jcs.yajcache.util;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.util;
-
import java.util.Arrays;
/**
@@ -27,7 +29,7 @@
/**
* Returns true if the two input arguments are equal, handling cases
- * when they are arrays.
+ * when they are arrays.
* Returns false otherwise.
*/
public boolean equals(Object lhs, Object rhs) {
@@ -37,13 +39,13 @@
return false;
Class lClass = lhs.getClass();
Class rClass = rhs.getClass();
-
+
if (lClass.isArray()
&& rClass.isArray())
{
Class lCompType = lClass.getComponentType();
Class rCompType = rClass.getComponentType();
-
+
if (lCompType.isPrimitive()) {
if (rCompType.isPrimitive()) {
if (lCompType != rCompType)
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/SerializeUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/SerializeUtils.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/SerializeUtils.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/SerializeUtils.java Thu May 10 09:03:42 2007
@@ -1,20 +1,23 @@
+package org.apache.jcs.yajcache.util;
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.util;
import java.io.Serializable;
import java.lang.reflect.Array;
@@ -36,12 +39,12 @@
*/
public <V extends Serializable> V dup(V obj) {
Class k = null;
-
- if (obj == null
+
+ if (obj == null
|| ClassUtils.inst.isImmutable(k=obj.getClass()))
return obj;
Class t = k.getComponentType();
-
+
if (t != null) {
// an array.
if (ClassUtils.inst.isImmutable(t))
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/IKeyedReadWriteLock.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/IKeyedReadWriteLock.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/IKeyedReadWriteLock.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/IKeyedReadWriteLock.java Thu May 10 09:03:42 2007
@@ -1,21 +1,23 @@
+package org.apache.jcs.yajcache.util.concurrent.locks;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-
-
-package org.apache.jcs.yajcache.util.concurrent.locks;
import java.util.concurrent.locks.Lock;
Modified: jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/KeyedReadWriteLock.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/KeyedReadWriteLock.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/KeyedReadWriteLock.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/src/org/apache/jcs/yajcache/util/concurrent/locks/KeyedReadWriteLock.java Thu May 10 09:03:42 2007
@@ -1,21 +1,24 @@
+package org.apache.jcs.yajcache.util.concurrent.locks;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.util.concurrent.locks;
-
import java.lang.ref.ReferenceQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -31,7 +34,7 @@
/**
- * Factory for key specific ReadWriteLock.
+ * Factory for key specific ReadWriteLock.
* Unused locks are automatically garbage collected.
*
* @author Hanson Char
@@ -39,16 +42,16 @@
@CopyRightApache
public class KeyedReadWriteLock<K> implements IKeyedReadWriteLock<K> {
private static final boolean debug = true;
-
- private final @NonNullable
- ConcurrentMap<K, KeyedWeakReference<K,ReadWriteLock>> rwlMap =
+
+ private final @NonNullable
+ ConcurrentMap<K, KeyedWeakReference<K,ReadWriteLock>> rwlMap =
new ConcurrentHashMap<K, KeyedWeakReference<K,ReadWriteLock>>();
private final @NonNullable Class<? extends ReadWriteLock> rwlClass;
- private final @NonNullable ReferenceQueue<ReadWriteLock> refQ =
+ private final @NonNullable ReferenceQueue<ReadWriteLock> refQ =
new ReferenceQueue<ReadWriteLock>();
- private final @NonNullable KeyedRefCollector<K> collector =
+ private final @NonNullable KeyedRefCollector<K> collector =
new KeyedRefCollector<K>(refQ, rwlMap);
-
+
private final AtomicInteger countRWLockCreate = new AtomicInteger(0);
private final AtomicInteger countReadLock = new AtomicInteger(0);
private final AtomicInteger countWriteLock = new AtomicInteger(0);
@@ -57,7 +60,7 @@
private final AtomicInteger countLockRefEmpty = new AtomicInteger(0);
private final AtomicInteger countLockNew = new AtomicInteger(0);
private final AtomicInteger countLockExist = new AtomicInteger(0);
-
+
public KeyedReadWriteLock() {
this.rwlClass = ReentrantReadWriteLock.class;
}
@@ -81,8 +84,8 @@
ReadWriteLock ret = this.getExistingLock(key);
return ret == null ? this.tryNewLock(key) : ret;
}
- /**
- * Returns an existing RWLock for the specified key, or null if not found.
+ /**
+ * Returns an existing RWLock for the specified key, or null if not found.
*/
private ReadWriteLock getExistingLock(@NonNullable final K key) {
KeyedWeakReference<K,ReadWriteLock> ref = this.rwlMap.get(key);
@@ -131,10 +134,10 @@
private @NonNullable ReadWriteLock tryNewLock(@NonNullable final K key)
{
final ReadWriteLock newLock = this.createRWLock();
- final KeyedWeakReference<K,ReadWriteLock> newLockRef =
+ final KeyedWeakReference<K,ReadWriteLock> newLockRef =
new KeyedWeakReference<K,ReadWriteLock>(key, newLock, refQ);
do {
- KeyedWeakReference<K,ReadWriteLock> ref =
+ KeyedWeakReference<K,ReadWriteLock> ref =
this.rwlMap.putIfAbsent(key, newLockRef);
if (ref == null) {
// successfully deposited the new lock.
@@ -143,7 +146,7 @@
return newLock;
}
ReadWriteLock rwl = this.toLock(ref);
-
+
if (rwl != null) {
return rwl;
}
Modified: jakarta/jcs/trunk/sandbox/yajcache/test/log4j.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/test/log4j.xml?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/test/log4j.xml (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/test/log4j.xml Thu May 10 09:03:42 2007
@@ -1,18 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2005 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.
-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
@@ -24,7 +27,7 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
+ <param name="ConversionPattern"
value="[%d{dd/MM hh:mm:ss}] %5p %c{2}: %m%n" />
</layout>
</appender>
@@ -34,7 +37,7 @@
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="100"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
+ <param name="ConversionPattern"
value="[%d{dd/MM/yy hh:mm:ss:sss}] %5p %c{2}: %m%n" />
</layout>
</appender>
Modified: jakarta/jcs/trunk/sandbox/yajcache/test/org/apache/jcs/yajcache/core/CacheManagerTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/sandbox/yajcache/test/org/apache/jcs/yajcache/core/CacheManagerTest.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/sandbox/yajcache/test/org/apache/jcs/yajcache/core/CacheManagerTest.java (original)
+++ jakarta/jcs/trunk/sandbox/yajcache/test/org/apache/jcs/yajcache/core/CacheManagerTest.java Thu May 10 09:03:42 2007
@@ -1,21 +1,24 @@
+package org.apache.jcs.yajcache.core;
+
/*
- * Copyright 2005 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
+ * 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
+ * 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.
*/
-package org.apache.jcs.yajcache.core;
-
import junit.framework.*;
import org.apache.commons.logging.Log;
@@ -30,7 +33,7 @@
@TestOnly
public class CacheManagerTest extends TestCase {
private Log log = LogFactory.getLog(this.getClass());
-
+
public void testGetCache() {
CacheManager.inst.getCache("myCache", String.class);
CacheManager.inst.removeCache("myCache");
@@ -82,7 +85,7 @@
log.debug("Test simulation of the worst case scenario: "
+ "race condition in creating cache AND class cast exception");
try {
- ICache<Double> doubleCache =
+ ICache<Double> doubleCache =
CacheManager.inst.testCreateCacheRaceCondition(
"race", Double.class, CacheType.SOFT_REFERENCE);
assert false : "Bug: Cache for Integer cannot be used for Double";
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org