Skip to content

Tag: java

About unsynchronized & synchronized access in Java Collections Framework?

Can anyone explain what is unsynchronized & synchronized access in Java Collections Framework? Answer Synchronized vs unsynchronized access doesn’t have to do with the Java Collections Framework per see. Synchronized access means that you have some sort of locking for accessing the data. This can be introduced by using the synchronized keyword or by using some of the higher level

How to run a java class with a jar in the classpath?

So, I can do this very well: if ./mypackage/MyClass.class exists. I can also happily do this: if the class file exists in the appropriate part of the jar. Easy stuff. But I can’t for the life of me manage to do something like this: where ./mypackage/MyClass.class exists, and where ./utilities.jar exists (not containing MyClass, of course). Am I about to

Remove row being edited from JTable

I have a JTable and a button next to it that calls deleteSelectedRows(), which does exactly what it sounds like: But if a cell was in the act of being edited when it (and/or cells above it) were deleted, the edited cell stayed while the rest left, like this: And then trying to exit out of the editing threw an

Does any JVM implement blocking with spin-waiting?

In Java Concurrency in Practice, the authors write: When locking is contended, the losing thread(s) must block. The JVM can implement blocking either via spin-waiting (repeatedly trying to acquire the lock until it succeeds) or by suspending the blocked thread through the operating system. Which is more efficient depends on the relationship between context switch overhead and the time until