Georgy Bolyuba

Ranch Hand
+ Follow
since Feb 18, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Georgy Bolyuba

Do you have a getter for endDate?

Originally posted by Subhadip Chatterjee:
Hi,
<url>?jsessionid=2089718#...For an example, "www.amazon.com" woulds be changed to "www.amazon.com?jsessionid='2089718#'".



I think it would be <url>;jsessionid=...
17 years ago

Originally posted by John Meyers:

It would be the container's job to keep them in sync wouldn't it ?.


Nope.

When I said about one instance of servlet I have talked about "one server" case (without clustering). If you have distributed web application you will have one instance of servlet per JVM. Fields will not be synchronized by containers.

Originally posted by Bear Bibeault:

The bottom line is that it is asking for trouble to use read/write class or instance variables in a servlet. And as the context scopes are availabe to store data in a safe fashion, there's no need, so don't do it.



Agree. Servlet should be stateless and thread-safe.

FYI: servlet context will not be synchronized by containers (in case of distributed web application). Only session will be synchronized.

Refs:
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
SRV.2.2 Number of Instances
SRV.7.7.2 Distributed Environments
17 years ago
There will be only one servlet instance per JVM (one servlet for one servlet declaration in DD).
17 years ago
You trying to find "ejb/SimpleConverter":

Object objref = myEnv.lookup("ejb/SimpleConverter");

Just make sure that "ejb/SimpleConverter" is correct name for ConverterHome.

It looks like something else is binded with name "ejb/SimpleConverter".
According to EJB 2.1 spec SFSB can be passivated after timeout. Try to play with container settings.
As far as I understand you can not deserialize an object if you do not have its class on your classpath. This sounds reasonable for me.
This really depends on type of EJB.

Session beans method can be excuted by one thread at given time.

Only one Statefull session bean can be executed at given time.

Several methods of stateless session bean can be executed at given time.

<hr></blockquote>

Do you know the size of your message? If it is true I think it would be better to create simple byte array.


I understand how I can do this with bit-masking, but JAVA doesn't allow me to use literal hexadecimal values, so it's proving a bit challenging.



I am not sure I get you right, but how about this and this?
[ June 29, 2006: Message edited by: Georgy Bolyuba ]
18 years ago
Thanks everybody for your answers. I think now this subject is clear for me.

Originally posted by Ilja Preuss:



What would be the advantage of doing this?
</blockquote>

I think this can make code easer to understand. It's like if AChild said: "Im sure that method() of ABase is implemeting mathod() of A. Trust me." And in code from my first post it look like AChild knows nothing about method().

Originally posted by Stan James:
This makes me uncomfortable. ABase has the method we need, but it doesn't claim to know anything about the interface. It might have the signature but do something completely undesirable with it. AChild glues together the interface which promises certain behavior and superclass which does not.

Of course polymorphism is all about doing different things with the same signature and I like to be able to introduce new unpredicted behavior at runtime, so maybe AChild takes responsibility for knowing the ABase really does the right thing. This still looks like a trick to sneak ABase into someplace it doesn't belong.

Back in VB4 days we used to practice what I called "polymorphism by coincidence". A method gets a parameter of unknown type and tries to call a method on it. If the parameter object has that method you go merrily on your way. If not then "on error goto" does something else. Does that sound similar?



Eah... It might be one of the good reason for writing this code.

As for me I think it would be good idea to add this method to AChild


Or maybe it is good idea for compiler to spot inadvertences like that?

Originally posted by Devesh H Rao:

Makes sense to me if ASample is a customized class for specific clients, ABase is the core of a product and AChild and A are used as switch to turn on or off specific features of the product for a client.

The product ABase core can contain all the business functionality which is common across clients, AChild can build on client specific functionality and A can be used to provide conditional access.



It's understandable, but I think this is not the best way for customize your code.

Originally posted by Mr. C Lamont Gilbert:
I agree Ilja almost. Problem is child class does not adapt base class. it just wears an interface and inadvertently opens itself up to new usages.


This code is definitely looks like adapter for me. But I've asked my question because I cannot spot the problem and I was sure that there is some thing strange in that code. Now I can say the problem is in inadvertence . That is why I was confused.


As it stands the interface almost seems to be scavaging for any class that fits its signature



Sorry, but I didn't get this phrase.
A little bit strange quiestion, but...

A friend of mine got this code during interview:


As you can see there is something like "indirect realization" in this code. My friend was asked: "Where it might be usefull?"

He asked me. Now I'm asking you.