Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - guava-libraries: is Iterators.cycle() thread-safe? -


suppose have following class:

public class foo {        private list<integer> list = lists.newarraylist(1, 2, 3, 4, 5);     private iterator<integer> iterator = iterators.cycle(list);        public void bar(){           integer value = iterator.next();           dosomethingwithaninteger(value);     }   }   

if instance of foo acessed simultaneously 2 threads, need each thread gets different value iterator.next(). bar() method have made synchronized? or iterator.next() guaranteed thread-safe?

in example, using arraylist underlying iterable. thread-safety of cyclic iterator depend on specific iterable implementation?

thank you.

pretty nothing in guava guaranteed thread safe unless documented such.

you not have synchronize entire bar method, should wrap call iterator.next() in synchronized block. eg:

public void bar(){       integer value;     synchronized (iterator) {         value = iterator.next();       }     dosomethingwithaninteger(value); }   

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -