You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2012/07/10 11:54:01 UTC

svn commit: r1359548 - in /river/jtsk/trunk/src: com/sun/jini/fiddler/FiddlerImpl.java com/sun/jini/jeri/internal/runtime/SelectionManager.java com/sun/jini/norm/NormServerBaseImpl.java org/apache/river/api/security/DefaultPolicyScanner.java

Author: peter_firmstone
Date: Tue Jul 10 09:54:01 2012
New Revision: 1359548

URL: http://svn.apache.org/viewvc?rev=1359548&view=rev
Log:
URI spaces in codebase strings caused problems with Windows platforms - fixed.

Removed calls to Thread.yield().

Modified:
    river/jtsk/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java
    river/jtsk/trunk/src/com/sun/jini/jeri/internal/runtime/SelectionManager.java
    river/jtsk/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java
    river/jtsk/trunk/src/org/apache/river/api/security/DefaultPolicyScanner.java

Modified: river/jtsk/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java?rev=1359548&r1=1359547&r2=1359548&view=diff
==============================================================================
--- river/jtsk/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java (original)
+++ river/jtsk/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java Tue Jul 10 09:54:01 2012
@@ -2430,7 +2430,13 @@ class FiddlerImpl implements ServerProxy
                 /* Unexport only if there are no pending or in-progress calls*/
                 while(!unexported && (System.currentTimeMillis() < endTime)) {
                     unexported = serverExporter.unexport(false);
-                    if(!unexported) Thread.yield();
+                    if(!unexported) try {
+                        // Thread.yield();
+                    Thread.sleep(MAX_UNEXPORT_DELAY / 4);
+                } catch (InterruptedException ex) {
+                    // Reset the interrupt
+                    Thread.currentThread().interrupt();
+                }
                 }//end loop
             if(!unexported) {//Not yet unexported. Forcibly unexport
                 serverExporter.unexport(true);
@@ -2445,7 +2451,11 @@ class FiddlerImpl implements ServerProxy
 	    try {
 		leaseExpireThread.join();
 		if(log != null) snapshotThread.join();
-	    } catch (InterruptedException e) { }
+	    } catch (InterruptedException e) { 
+                // Should the interrupt really be swallowed?  Or should we reset
+                // the status for later handling?
+                Thread.currentThread().interrupt();
+            }
 	    if(log != null) log.deletePersistentStore();
 	    if (activationID != null) {
                 /* Inform the activation system that the object corresponding

Modified: river/jtsk/trunk/src/com/sun/jini/jeri/internal/runtime/SelectionManager.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/jeri/internal/runtime/SelectionManager.java?rev=1359548&r1=1359547&r2=1359548&view=diff
==============================================================================
--- river/jtsk/trunk/src/com/sun/jini/jeri/internal/runtime/SelectionManager.java (original)
+++ river/jtsk/trunk/src/com/sun/jini/jeri/internal/runtime/SelectionManager.java Tue Jul 10 09:54:01 2012
@@ -368,7 +368,8 @@ public final class SelectionManager {
 		} catch (Error e) {
 		    String message = e.getMessage();
 		    if (message != null && message.startsWith("POLLNVAL")) {
-			Thread.yield();
+//			Thread.yield();
+                        Thread.sleep(100L);
 			continue;		// work around 4458268
 		    } else {
 			throw e;

Modified: river/jtsk/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java?rev=1359548&r1=1359547&r2=1359548&view=diff
==============================================================================
--- river/jtsk/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java (original)
+++ river/jtsk/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java Tue Jul 10 09:54:01 2012
@@ -993,6 +993,8 @@ abstract class NormServerBaseImpl
 				continue; // go back to top of loop
 			    } catch (InterruptedException e) {
 				// someone wants us dead
+                                // Reset the interrupt
+                                Thread.currentThread().interrupt();
 				return;
 			    }
 			} else {
@@ -1041,9 +1043,16 @@ abstract class NormServerBaseImpl
 		    } finally {
 			store.releaseMutatorLock();
 		    }
-
-		    // Give other threads a chance to run
-		    Thread.yield();
+                    try {
+                        // Give other threads a chance to run
+                        long expires = set.getExpiration() - System.currentTimeMillis();
+                        // Thread sleep time decreases as it approaches the lease expiration.
+                        Thread.sleep(expires / 2);
+                        // Thread.yield();
+                    } catch (InterruptedException ex) {
+                        // Reset the interrupt status.
+                        Thread.currentThread().interrupt();
+                    }
 		} catch (RuntimeException e) {
 		    logger.log(
 			Level.INFO,
@@ -1606,7 +1615,15 @@ abstract class NormServerBaseImpl
 		    logger.log(Level.FINEST, "...rslt = " + unexported);
 
 		    if (!unexported) {
-			Thread.yield();
+			// Thread.yield();
+                        try {
+                            // Sleep time decreases as we approach the max delay
+                            // and retries increase.
+                            Thread.sleep((end_time - System.currentTimeMillis())/2);
+                        } catch (InterruptedException e){
+                            // Reset interrupt status
+                            Thread.currentThread().interrupt();
+                        }
 		    }
 		}
 	    } catch (NoSuchObjectException e) {

Modified: river/jtsk/trunk/src/org/apache/river/api/security/DefaultPolicyScanner.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/src/org/apache/river/api/security/DefaultPolicyScanner.java?rev=1359548&r1=1359547&r2=1359548&view=diff
==============================================================================
--- river/jtsk/trunk/src/org/apache/river/api/security/DefaultPolicyScanner.java (original)
+++ river/jtsk/trunk/src/org/apache/river/api/security/DefaultPolicyScanner.java Tue Jul 10 09:54:01 2012
@@ -496,7 +496,8 @@ class DefaultPolicyScanner {
                     Collection<PrincipalEntry> pe,
                     Collection<PermissionEntry> perms){
             this.signers = signers;
-            this.codebase = codebase;
+            // Spaces are an illegal character in URI, so get rid of them now.
+            this.codebase = codebase.replace(" ", "%20");
             this.principals = pe;
             this.permissions = perms;
         }