river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Firmstone <j...@zeus.net.au>
Subject Re: qa tests
Date Tue, 17 Nov 2009 21:18:24 GMT
Initially I replaced all the instances of Permissions with 
ConcurrentPermissions to maximise testing, but it's purpose is a utility 
class for DynamicPolicyProvider which lives in jsk-policy.jar  However 
having said that, the class doesn't really need AllPermission, it uses 
reflection on class constructors to resolve UnresolvedPermission but 
that's about all it needs.

ConcurrentPermissions totally destabilised GrantPermission, which uses 
lazy construction and has fields that aren't synchronized, its current 
stability is reliant on Permissions heavy synchronization and single 
threadedness.

Ideally, all PermissionCollection instances returned by 
Permission.getPermissionCollection shouldn't use any internal 
synchronization, unless implies() is a mutator method, since 
ConcurrentPermissions manages this for us using a wrapper called 
MultiReadPermissionCollection.  Last time I looked at Permissions, it 
synchronized on all calls, it's unnecessary and hampers performance for 
the average PermissionCollection to try and manage their own 
synchronization.  A better solution would be similar to what was done 
with Vector, ArrayList and Collections.

After examining the code, I've decided to reimplement 
DynamicPolicyProvider and GrantPermission.

I'm writing a service utilising java.util.ServiceLoader called 
DynamicPolicyProviderSpi so that my implementation is a pluggable 
component, it  requires Java5, for more limited environments that don't 
need concurrency, the earlier implementation is smaller and may be more 
suitable, I intend to make it pluggable also.

In addition, the new implementation will be able to revoke permissions 
too, rather than just accumulating Permission's over time.

So we'll end up with the choice of two implementations, jsk-policy.jar 
and jsk-policy-concurrent.jar

Cheers,

Peter.

Gregg Wonderly wrote:
> I am curious why you put that into jsk-policy.jar?  That class doesn't 
> have the same requirements for class loading that the contents of 
> jsk-policy.jar once had does it?
>
> Gregg Wonderly
>
> Peter Firmstone wrote:
>> I'm running into problems with the following test, it doesn't have 
>> jsk-policy.jar on it's classpath
>>
>> Anyone know where to set the classpath for this test?
>>
>> The missing class file 
>> org.apache.river.security.concurrent.ConcurrentPermissions is in 
>> jsk-policy.jar
>>
>> I haven't got jsk-policy installed in jre/lib/etc/
>>
>> testClass=DelayDiscoveryAfterDiscard
>> testCategories=locatordiscovery,locatordiscovery_impl,impllocatordiscovery 
>>
>> include0=locatordiscovery.properties
>> include1=com/sun/jini/test/share/reggie1_0.properties
>> com.sun.jini.test.impl.locatordiscovery.discardDelayFirstWait=5000
>> com.sun.jini.test.impl.locatordiscovery.discardDelay=30000
>>
>> This is where I'm running into difficulty:
>>
>> Running 
>> com/sun/jini/test/impl/locatordiscovery/DelayDiscoveryAfterDiscard.td
>> Time is Fri Nov 13 04:46:43 EST 2009
>> Starting test in separate process with command:
>> /usr/jdk/instances/jdk1.6.0/jre/bin/java 
>> -Djava.security.policy=file:/opt/src/ApacheRiver/trunk/qa/harness/policy/defaulttest.policy

>> -cp 
>> /opt/src/ApacheRiver/trunk/qa/lib/jiniharness.jar:/opt/src/ApacheRiver/trunk/qa/lib/jinitests.jar:/opt/src/ApacheRiver/trunk/lib/jsk-platform.jar:/opt/src/ApacheRiver/trunk/lib/jsk-lib.jar

>> -client -Dcom.sun.jini.jsk.port=8080 -Dcom.sun.jini.qa.port=8081 
>> -Dcom.sun.jini.jsk.home=/opt/src/ApacheRiver/trunk 
>> -Dcom.sun.jini.qa.home=/opt/src/ApacheRiver/trunk/qa 
>> -Dcom.sun.jini.qa.harness.harnessJar=/opt/src/ApacheRiver/trunk/qa/lib/jiniharness.jar

>> -Dcom.sun.jini.qa.harness.testJar=/opt/src/ApacheRiver/trunk/qa/lib/jinitests.jar

>> -Dcom.sun.jini.qa.harness.runjiniserver=true 
>> -Dcom.sun.jini.qa.harness.runkitserver=true 
>> -Djava.security.properties=file:/opt/src/ApacheRiver/trunk/qa/harness/trust/dynamic-policy.properties

>> -Djava.util.logging.config.file=/opt/src/ApacheRiver/trunk/qa/src/com/sun/jini/test/resources/qa1.logging

>> -Dcom.sun.jini.test.home=/opt/src/ApacheRiver/trunk/qa 
>> -Dcom.sun.jini.test.port=8082 
>> -Dcom.sun.jini.qa.harness.policies=jar:file:/opt/src/ApacheRiver/trunk/qa/lib/jinitests.jar!/com/sun/jini/test/resources/jinitest.policy

>> -Djava.ext.dirs=/usr/jdk/instances/jdk1.6.0/jre/lib/ext:/usr/jdk/packages/lib/ext:/opt/src/ApacheRiver/trunk/qa/lib-ext:/opt/src/ApacheRiver/trunk/lib-ext

>> -Djava.security.debug=access com.sun.jini.qa.harness.MasterTest 
>> com/sun/jini/test/impl/locatordiscovery/DelayDiscoveryAfterDiscard.td
>>
>> TIME: 04:46:45
>>
>> MasterTest.doTest INFO:
>> ============================== CALLING SETUP() 
>> ==============================
>>
>> 13/11/2009 04:46:46 com.sun.jini.tool.ClassServer run
>> INFO: ClassServer started [[/opt/src/ApacheRiver/trunk/qa/lib/], port 
>> 8081]
>>
>> 13/11/2009 04:46:46 com.sun.jini.tool.ClassServer run
>> INFO: ClassServer started [[/opt/src/ApacheRiver/trunk/lib-dl/], port 
>> 8080]
>>
>> 13/11/2009 04:46:46 com.sun.jini.tool.ClassServer run
>> INFO: ClassServer started [[/opt/src/ApacheRiver/trunk/qa/lib/], port 
>> 8082]
>>
>> NonActGrp-out: Exception in thread "main" 
>> java.lang.NoClassDefFoundError: 
>> org/apache/river/security/concurrent/ConcurrentPermissions
>> NonActGrp-out:     at java.lang.Class.forName0(Native Method)
>> NonActGrp-out:     at java.lang.Class.forName(Class.java:247)
>> NonActGrp-out:     at 
>> sun.misc.Service$LazyIterator.next(Service.java:271)
>> NonActGrp-out:     at 
>> java.rmi.server.RMIClassLoader.initializeProvider(RMIClassLoader.java:688) 
>>
>> NonActGrp-out:     at 
>> java.rmi.server.RMIClassLoader.access$000(RMIClassLoader.java:93)
>> NonActGrp-out:     at 
>> java.rmi.server.RMIClassLoader$1.run(RMIClassLoader.java:103)
>> NonActGrp-out:     at 
>> java.security.AccessController.doPrivileged(Native Method)
>> NonActGrp-out:     at 
>> java.rmi.server.RMIClassLoader.<clinit>(RMIClassLoader.java:100)
>> NonActGrp-out:     at 
>> sun.rmi.server.MarshalOutputStream.annotateClass(MarshalOutputStream.java:75) 
>>
>> NonActGrp-out:     at 
>> java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1250) 
>>
>> NonActGrp-out:     at 
>> java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1203)
>> NonActGrp-out:     at 
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387) 
>>
>> NonActGrp-out:     at 
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> NonActGrp-out:     at 
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>> NonActGrp-out:     at 
>> java.rmi.MarshalledObject.<init>(MarshalledObject.java:101)
>> NonActGrp-out:     at 
>> com.sun.jini.qa.harness.NonActivatableGroupImpl.main(Unknown Source)
>> NonActGrp-out: Caused by: java.lang.ClassNotFoundException: 
>> org.apache.river.security.concurrent.ConcurrentPermissions
>> NonActGrp-out:     at 
>> java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>> NonActGrp-out:     at 
>> java.security.AccessController.doPrivileged(Native Method)
>> NonActGrp-out:     at 
>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>> NonActGrp-out:     at 
>> java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>> NonActGrp-out:     at 
>> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
>> NonActGrp-out:     at 
>> java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>> NonActGrp-out:     at 
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>> NonActGrp-out:     ... 16 more
>>
>>
>
>


Mime
View raw message