Alexei Kaigorodov

Greenhorn
+ Follow
since Feb 24, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alexei Kaigorodov

No. POJO class can implement any interface, or implement no interface. It can extend any class (note any user-defined class extends some other class, probably java.lang.Object). The sense of the notion of POJO is that it has not to implement specific interface or extend specific class, as it was usual in early persistent libraries.
11 years ago
So your SafetyBean has dozens of properties? This needs refactoring. Group properties like goal, color, and measured in one class, say, Item. Then your code will look like:

The next step is to create new method assignColor:


The last step is to keep Items in collections, rather than in fields, iterate that collections and apply assignColor in a loop.

One note on code logic: the third condition is negation of the first one, so if we checked the first and it yelds false, then the third will always be true. As a result, the 4th alternative will never happen, and white color will never be set.

11 years ago
Try "HttpsURLConnection rc" instead of HttpURLConnection .
11 years ago
"it can create an object of B in A" is incorrect wording.

akila sekaran wrote:is String...[] args a legal one ?


No.
The number of threads in a thread pool is calculated of available computational resources: number of processors and I/O devices. Good starting point is the number of available processors (cores). If tasks do some I/O, the optimal number of threads can be corrected: increased for network IO, decreased for disk IO. But since number of cores is relatively small, there is no much sense to decrease number of threads for disk IO, but you should expect that tasks doing disk IO would not run in parallel.

Choosing number of threads based on logical resources (15 directories, in your case) has no sense. All logical dependencies should be managed in some other way, usually by properly submitting tasks to threadpool in a timely manner.

And since renaming would be done by the O/S anyway, the rate of parallelization is limited by O/S. Very likely, O/S does not parallelize file renaming, so the whole idea to exploit thread pool is worthless.
means reference to an instance of enclosing class AB. This reference is required to access fields amd methods of AB from within nested class B.
11 years ago
In order to synchronize 2 threads, the synchronized object must be the same. In your code, each thread is synchronizing on its own Thread object, which is meaningless.
11 years ago
Unless it is required to make heavy calculations to fill object's content, creation is faster. Note that retrieving from database also includes object creation, and access to database itself requires a lot of processor's cycles.
11 years ago

davo ram wrote:
java-cp org.apache.axis.client.AdminClient undeploy.wsdd



The option -cp expects a list of jar/directories where your classes reside. Here java thinks that org.apache.axis.client.AdminClient is such a list, and undeploy.wsdd is the main class. Since the classpath is already set in the environment variable, just remove "-cp" from the command line
11 years ago

A Jj wrote:


When list2.equals(list1), why don't you remove one of them?
11 years ago

Senthil Kumar Sekar wrote:I heard that thread behavior cannot be judged.But this looks more weird - Both threads runs simultaneously and main thread gets completed before child thread?


This is not weird. This is expected behaviour.

Senthil Kumar Sekar wrote:I guess they are considered as 2 separate threads and not parent and child here.Is that so?


What do you mean by child and parent? Why do you think that child/parent relationship in Java is supported in any way?

Gynnad Paullussen wrote: I get the error JAR IS NULL..


This is not an error, this message merely indicates that there is no more jar entries.
Add printing of jarEntry.getName () to see if there are jar entries at all.
11 years ago
http://docs.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html includes paragraph "Direct vs. non-direct buffers". It is rather old feature, so you probably has in mind something other when talking about "direct buffering". What exactly did you mean?
11 years ago