Pankaj Kumarkk

Ranch Hand
+ Follow
since Apr 17, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pankaj Kumarkk

Can somebody please help on this. I would greatly appreciate this.

5 years ago
I have a query on a design question.
The requirement is as follows:
I have to develop a generic rule service. My application has list of possible rules as components (say Rule1, Rule2, Rule3, Rule4, Rule5, Rule6, Rule7 and so on). Based on user input I have to trigger one or more of these rules. e.g
If input=1 then trigger Rule1, Rule2, Rule3
If input=2 then trigger Rule1, Rule2, Rule4
If input=3 then trigger Rule1, Rule2
If input=4 then trigger Rule5, Rule6, Rule7
and so on.
I have designed all rules to be implementing same interface(say RuleInterface).
RuleInterface has a single method as follows - execute()
My design approach is as follows:

Develop a RuleProcessor
which will have a attribute - Collection<Rule> ruleCollection
and a method process(int input) which will iterate each rule from rules and execute it.

My query is how do I design the set-up of ruleCollection attribute.One design I could think of is to populate all rules combination in DB and then use it to populate the ruleCollection attribute. Thus given above requirement, we will have 4 entries in DB (one for each input value). Is there a better and simple design possible(I am sure there is). I am tending to look at a design solution which is java based (and not necessarily dependent on DB) but am open to all the suggestions. I am using spring framework so if spring provides something out of the box then I would prefer that.

5 years ago
Can you please suggest on good book for java performance tuning. The topics I want to cover:

Core java memory concepts
Core Java performance tuning
Java based web application tuning
Java based web services(rest & soap) tuning

Also suggest if there are any good trainings available on same. I browsed net but could not find anything suitable.
I am a java developer with good knowledge of java(8+ years experience).

Thanks for reading this,

6 years ago
I want to fail all logins which happened within a specific time period since session start(e.g 150ms). I can write code to achieve this. I wanted to know if spring security has this functionality built in where I can specify a timeperiod and all login request within that specified time fails.

6 years ago
Hi I have a class which is mutable. This class is available in a 3rd party jar and thus I do not own the source code.

I have to use this class in multithreaded scenario and I thus wanted to have a immutable version of it so that I can use it freely in my threads.

The existing class looks like

class Order
private int orderNum;

private ArrayList items;

private Date orderDate;

getters method

setters method


Can somebody tell me how do I create a immutable version of this class.

10 years ago
I would like to know the scope of hibernate persistent context. As per my understanding the persistent context is scoped at session level. Thus every hibernate session has its own persistent context.
Is this correct or am I missing something.
Thanks for the response. I still do not know if asynchronous web service is something driven from WS-I BP specification. Thus are all different WS-I BP compliant vendors supposed to provide asynchronous web services behavior.
I tried the WS-I web site but could not determine the answer.

10 years ago
How do you design a consumer which calls 2 web services from different sources and then combine results from them to give a final result.
The question is that the consumer is responsible for transaction scope. So if one of the service call fails then the other service call should be reverted.
Any help will be appreciated
10 years ago
It seems that the xsd file is not in classpath.
10 years ago
Thanks for the reply. It was useful.
essentially asynchronous servlet is useful as it helps in reusing the servlet thread when a request is being processed in a long running process.
10 years ago
In JEE6 there is support for asynchronous servlets. This means that the servlet can be called asynchronously.

I am struggling to understand how the asynchronous servlet will work in practical scenario.
1. User A makes a servlet call using a url say http:/
2. The servlet returns immediately while spawning a new thread to process the servlet request
3. User A then moves to another screen
4. In the meanwhile the servlet processing finishes, then how would this response be sent to client.

If somebody can explain this it will be very helpful
10 years ago
JAX-WS 2.0 supports asynchronous web service using polling and callback mechanism.

Can somebody tell me if this is a feature specific to JEE or is it part of WS-I BP specification.
Thus can a C# client(ie a non java client) access a web service asynchronously.
10 years ago
I want to know why you would use castor as a serialization framework when developing web services.

I understand that you can develop a web service without using an external serialization framework like castor. I would just like to know when it is recommended to use a external serialization framework like castor.
10 years ago
Option 2 is what is typically used. Authentication is typically for a application(and not operation). If you want to control operation level access then i would guess that this would come under scope of authorization. You can decide what authorization mechanism you use to limit users to specific operations only.
10 years ago
You basically have to write a web service client.
If you want to call as web service from click of a button on a jsp then below is what you would have to do:
1. Write a jsp page which takes in input parameter for the web service method
2. Write a servlet to recieve the request from the jsp and get all the input parameters
3. Generate the web service client side artifacts
4. Call the web service using the client proxie. This code for calling can be written in the servlet itself
5. Recieve the response from web service. Use that response to populate the result jsp

I do not know if spring provides all of this automatically. These are the steps you would need to do to invoke a web service from a jsp.

PS: Calling a web service from a jsp makes sense only if you are consuming web services in your web application.
10 years ago