Thanks for this info. On 3/13/07, Mondain <[EMAIL PROTECTED]> wrote:
Try to use the volatile keyword wherever you can with Java6 and later versions of Java5 http://www.javaperformancetuning.com/tips/volatile.shtml http://mindprod.com/jgloss/volatile.html http://www-128.ibm.com/developerworks/library/j-thread.html You will see better performance than using synchronize... Paul On 3/13/07, Sam Bou < [EMAIL PROTECTED]> wrote: > > > FYI, there is also the ConcurrentHashMap you can use: > > > http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentHashMap.html > > > > joseph wamicha wrote: > > > > It takes care of threads trying to access the same resource. The > method is > > synchronized and all locks and mutexes are taken care of by the JAVA > > runtime. Much more convenient than doing threading and resource > management > > in C. > > > > On 3/13/07, Dan Rossi <[EMAIL PROTECTED]> wrote: > >> > >> ive seen the statement before way over my head though > >> > >> http://today.java.net/pub/a/today/2004/08/02/sync1.html > >> > >> > >> joseph wamicha wrote: > >> > You may try using JAVA "synchronized" methods. > >> > > >> > On 3/13/07, Dan Rossi <[EMAIL PROTECTED]> wrote: > >> >> > >> >> Im also interested aswell, im also filling a hashmap with values > to > >> >> fudge the FMS virtual directories feature, but applied in the > >> >> filenamegenerator bean for now. Im wondering what the most safe > and > >> >> efficient way to add these values are ? > >> >> > >> >> public void setVirtualDirectories(String virtualDirectories) { > >> >> vdirectories = new HashMap<String,String>(); > >> >> directories = virtualDirectories.split (","); > >> >> for (int i = 0; i < directories.length; i++) { > >> >> directories[i] = directories[i].trim(); > >> >> String[] paths = directories[i].split(";"); > >> >> > >> >> if (!paths[0].equals("") && !paths[1].equals("")) > >> >> { > >> >> vdirectories.put(paths[0], paths[1]); > >> >> } > >> >> } > >> >> } > >> >> > >> >> public String generateFilename(IScope scope, String name, > >> >> String extension, GenerationType type) { > >> >> String filename; > >> >> > >> >> filename = playbackPath + name; > >> >> > >> >> String[] paths = name.split("/"); > >> >> > >> >> > >> >> if (( vdirectories.size() > 0) && vdirectories.containsKey > (paths[0])) > >> >> { > >> >> filename = vdirectories.get(paths[0]) + paths[1]; > >> >> } > >> >> > >> >> log.info("Generated FilePath: " + filename); > >> >> return filename; > >> >> > >> >> } > >> >> > >> >> the first path is split from the filename. > >> >> > >> >> properties setting > >> >> > >> >> virtualDirectories=dir1;file:C:/somedir, dir2;file:D:/somedir > >> >> > >> >> > >> >> Sam Bou wrote: > >> >> > Is Red5 single or multi-threaded? I noticed that in > >> >> http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1732 that > the > >> >> default is multi-threaded but I'm not sure if that is only for the > IO > >> >> processes or for other processes as well. > >> >> > > >> >> > If it's multi-threaded, as a Java newbie I'm wondering if I need > to > >> >> synchronize the appConnect and other methods if I have something > like > >> >> the > >> >> following, where many connections will be accessing the same > variables > >> >> clientCount and clientsMap: > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > public class Application extends ApplicationAdapter { > >> >> > > >> >> > private int clientCount = 0; > >> >> > > >> >> > private Map<String, List<String>> clientsMap = new > >> HashMap<String, > >> >> List<String>>(); > >> >> > > >> >> > public boolean appConnect(IConnection conn, Object[] params) > { > >> >> > > >> >> > clientCount++; > >> >> > > >> >> > clientsMap.put(clientId, clientInfoList); > >> >> > } > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > Any advice appreciated. > >> >> > > >> >> > Sam > >> >> > >> > > >> > > >> > ------------------------------------------------------------------------ > >> > > >> > _______________________________________________ > >> > Red5 mailing list > >> > [email protected] > >> > http://osflash.org/mailman/listinfo/red5_osflash.org > >> > > >> > >> > >> _______________________________________________ > >> Red5 mailing list > >> [email protected] > >> http://osflash.org/mailman/listinfo/red5_osflash.org > >> > > > > > > > > -- > > C is forever. > > > > _______________________________________________ > > Red5 mailing list > > [email protected] > > http://osflash.org/mailman/listinfo/red5_osflash.org > > > > > > -- > View this message in context: > http://www.nabble.com/Single-or-Multi-Threaded--tf3395583.html#a9462586 > Sent from the Red5 - English mailing list archive at Nabble.com. > > > _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org > -- The early bird may get the worm, but the second mouse gets the cheese. _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
-- C is forever.
_______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
