Win a copy of High Performance Python for Data Analytics this week in the Python forum!

Jack Nam

Ranch Hand
+ Follow
since Feb 09, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jack Nam

Assume that only one thread do the write operation, other just read. Would it be safe from memory visibility point of view?

Sorry for not mentioned that.

Paul Clapham wrote:No. But that's because declaring a variable as volatile doesn't make it thread-safe.

Hi Everybody,

I have a question on the scope of volatile.

If I have two classes MyObj and MyOtherObj. MyOtherObj is refered by MyObj.

public class MyObj {

public MyOtherObj myOtherObj = new MyOtherObj();

}

public class MyOtherObj {

public Boolean myBoolean= true;

}

And I have another class has a reference to MyObj with volatile attribute. Do I have to declare myBoolean as volatile to make it thread-safe?

public class MyClass{
private volatile MyObj myObj = new MyObj();

// access myBoolean from this class
myObj.myOtherObj.myBoolean = false;

}
Hi,
Got this from the log:

2011-06-02 14:28:16,145 [http-7777-1] WARN interceptor.PayloadValidatingInterce
ptor - XML validation error on request: cvc-complex-type.2.4.a: Invalid content
was found starting with element 'reference'. One of '{reference}' is expected.


Seems I do not do anything wrong. Any idea?
9 years ago
ignore what I wrote above. I set the dbug mode, and I found this:

2011-06-02 14:28:16,145 [http-7777-1] WARN interceptor.PayloadValidatingInterce
ptor - XML validation error on request: cvc-complex-type.2.4.a: Invalid content
was found starting with element 'reference'. One of '{reference}' is expected.


Seems I do not anything wrong. Any idea?

9 years ago
Hi everybody,

I have a complex type element which is defined in another dtd:

<complexType name="GetValueRequest">
<complexContent>
<extension base="bst:Request">
<sequence>
<element name="partyIdentifiers" type="fsvoc:PartyIdentifiers" minOccurs="1" maxOccurs="1"/>
</sequence>
</extension>
</complexContent>
</complexType>

// this is another dtd
<complexType name="PartyIdentifiers">
<sequence>
<element name="pi" type="int"/>
</sequence>
</complexType>


I got org.springframework.ws.soap.client.SoapFaultClientException: Validation error. However, if i put all in one dtd, everything is ok.
This is how i make the call.
def response = withEndpointRequest(serviceURL) {
GetValueRequest(xmlns: namespace) {
partyIdentifiers {
pi(1)
}
}
}


How to make it work with multiple dtd? Anyone knows?


9 years ago

Roel De Nijs wrote:The url was in the post, only lacking the "http://" part. That's why it was not being rendered. Other possibility: using google with "Sun Microsystems Certification Manager Database"...



Ohh k. Thanks Roel.

Roel De Nijs wrote:In the Sun Microsystems Certification Manager Databaseyou can create a Credentials Report (with an overview of all your certifications) and mail this report to an email address of your choice.



URL?

Roel De Nijs wrote:And what exactly do you mean with "validate"?



It means if someone can login and verify the certificate.
Anyone knows what is the url to validate my SCJD. I need it for immigration application.
then it would not be thread-safe.

Anupam Sinha wrote:What if someone accesses sequenceValue.getNextVal(); directly without the lock?

if >> synchronized getNextval is thread-safe. Then the equivalent synchronized(this) inside getNextval is also safe. Then synchronized(sequenceval) is also safe since those statements are synonym.

Anupam Sinha wrote:I think that the code is not thread safe.

This simple looking line



is not thread safe. Java only guarantees a 32 bit to be atomic (unless otherwise made atomic). So nextVal should be made volatile.

Apart from this I am not able to understand this program much.

I am unable to understand how this program (barring the above reason) will be thread safe (if it is made to compile).

getNextval is not synchronized so even acquiring a lock on sequenceValue shouldn't matter much.

I did googling on this topic, and it is kind of grey to me. Although the sequenceValue is thread-safe, but I wonder if the property is. It could be like a volatile array, not thread-safe for the element.
Hi Everybody,

If I access an instance of sequenceValue like below. Is it safe? should I make nextVal variable volatile?

synchronized(sequenceValue){
long newVal = sequenceValue.getNextVal();
}


class SequenceValue {

long nextval = 0;

public long getNextval() {
return nextval++;
}


}
k. noticed. thanks.

Roel De Nijs wrote:Hi Jack,

First of all congratulations!

Oracle has changed the grading policy: you will only get a score if you fail. So when you pass (like you did), you will not get any score, only the pass grade. So no total score anymore, no score per section.

Kind regards,
Roel

10 years ago