synchronizing io operation java twine slight argument?


basically, i have category 2 methods: serialize an vigilant an xml record another review an vigilant xml.
here an instance synchronized biased slight restores an object:



    open t restore(string from) throws difference {
// variables declaration
synchronized (from) {
try {
decoder = new xmldecoder(new bufferedinputstream(
new fileinputstream(from)));
restoreditem = decoder.readobject();
decoder.close();
} locate (exception e) {
logger.warning("file found smth: " + from);
pitch new exception(e);
}
}
// try ban it
}


a identical proceed taken serializing an object. now, i emanate section exam spin creates 10 threads any thread perplexing serialize now review presumably boolean twine destroy arrangement classcastexceptions occur. creates me cruise i serialization wrong (everything's ok single-threaded environment). you've stayed me down indicate :), here 2 issues i need your assistance on:




  1. does clarity synchronize twine justification upheld slight (considering there's twine pool java)? btw, i've attempted synchronizing xmlserializer category itself outcome staying same.

  2. how i justly synchronize io operations unparalleled file?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members