Changeset 7324
- Timestamp:
- Apr 6, 2017, 10:47:40 AM (6 years ago)
- Location:
- trunk/src/core/net/sf/basedb
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Job.java
r7323 r7324 1426 1426 @since 3.11 1427 1427 */ 1428 Serializable loadState( )1428 Serializable loadState(ClassLoader loader) 1429 1429 { 1430 1430 Serializable state = null; … … 1433 1433 String key = "/job-state/" + getId(); 1434 1434 StaticCache cache = Application.getStaticCache(); 1435 state = (Serializable)cache.load(key, 2000);1435 state = (Serializable)cache.load(key, loader, 2000); 1436 1436 if (state != null) cache.delete(key, 2000); 1437 1437 } -
trunk/src/core/net/sf/basedb/core/PluginRequest.java
r7322 r7324 83 83 this.plugin = plugin; 84 84 this.command = command; 85 this.state = job.loadState( );85 this.state = job.loadState(plugin.getClass().getClassLoader()); 86 86 this.pluginConfiguration = pluginConfiguration; 87 87 this.pluginDefinition = pluginDefinition; -
trunk/src/core/net/sf/basedb/util/StaticCache.java
r7141 r7324 33 33 import java.io.ObjectInputStream; 34 34 import java.io.ObjectOutputStream; 35 import java.io.ObjectStreamClass; 35 36 import java.io.OutputStream; 36 37 import java.io.Serializable; … … 408 409 public Object load(String key, int timeout) 409 410 { 411 return load(key, null, timeout); 412 } 413 414 public Object load(String key, ClassLoader loader, int timeout) 415 { 410 416 if (disabled) return null; 411 417 Serializable object = null; … … 416 422 if (in != null) 417 423 { 418 ObjectInputStream oin = new ObjectInputStream(in); 424 // Create stream and override resolveClass so we 425 // can load classes from the given class loader 426 ObjectInputStream oin = new ObjectInputStream(in) 427 { 428 @Override 429 protected Class<?> resolveClass(ObjectStreamClass streamClass) 430 throws IOException, ClassNotFoundException 431 { 432 Class<?> c = null; 433 try 434 { 435 c = super.resolveClass(streamClass); 436 } 437 catch (ClassNotFoundException ex) 438 { 439 if (loader == null) throw ex; 440 c = Class.forName(streamClass.getName(), false, loader); 441 } 442 return c; 443 } 444 }; 419 445 try 420 446 { … … 444 470 } 445 471 return object; 472 446 473 } 447 474
Note: See TracChangeset
for help on using the changeset viewer.