- References
- Sun's Java home(http://java.sun.com/)
- IBM's Java home(http://www.ibm.com/developerworks/java)
- Grails home(http://grails.org/)
- Terracotta home(http://terracotta.org/)
- Steps
- Install Java development kit
- Install latest grails
- Install latest terracotta
- Create terracotta's config file as follows
(Following is a example configuration, please refer to the terracotta documentation about the detail of the config file)
Following configuration is clustered the util.cache.Cache.cacheMap object, and set the named-lock for all the methods.<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd">
<servers>
<server name="server1" host="localhost">
<data>%(user.home)/terracotta/server-data</data>
<logs>%(user.home)/terracotta/server-logs</logs>
<dso>
<client-reconnect-window>10</client-reconnect-window>
<persistence>
<mode>temporary-swap-only</mode>
</persistence>
<garbage-collection>
<enabled>true</enabled>
<verbose>false</verbose>
<interval>180</interval>
</garbage-collection>
</dso>
<jmx-port>9520</jmx-port>
<l2-group-port>9530</l2-group-port>
</server>
</servers>
<clients>
<logs>%(user.home)/terracotta/client-logs</logs>
</clients>
<application>
<dso>
<roots>
<root>
<field-name>util.cache.Cache.cacheMap</field-name>
</root>
</roots>
<instrumented-classes>
<include>
<class-expression>util.cache.Cache</class-expression>
</include>
</instrumented-classes>
<locks>
<named-lock>
<lock-name>CacheMapWriteLock</lock-name>
<lock-level>write</lock-level>
<method-expression>* util.cache.Cache.clear(..)</method-expression>
</named-lock>
<named-lock>
<lock-name>CacheMapWriteLock</lock-name>
<lock-level>concurrent</lock-level>
<method-expression>* util.cache.Cache.set(..)</method-expression>
</named-lock>
<named-lock>
<lock-name>CacheMapWriteLock</lock-name>
<lock-level>concurrent</lock-level>
<method-expression>* util.cache.Cache.remove(..)</method-expression>
</named-lock>
<named-lock>
<lock-name>CacheMapReadLock</lock-name>
<lock-level>read</lock-level>
<method-expression>* util.cache.Cache.get(..)</method-expression>
</named-lock>
<named-lock>
<lock-name>CacheMapReadLock</lock-name>
<lock-level>read</lock-level>
<method-expression>* util.cache.Cache.contain(..)</method-expression>
</named-lock>
</locks>
</dso>
</application>
</tc:tc-config> - Start the terracotta server
${TC_INSTALL_DIR}/bin/start-tc-server.sh -f (Set path to the terracotta config) -n (Set server name in terracotta config file) - Set the environment variables
export JAVA_HOME=(Set JDK's home directory)
export GRAILS_HOME=(Set Grails home directory)
export JAVA_OPTS="(Set java option parameters if you need)"
export TC_INSTALL_DIR=(Set Teraccotta's home directory)
export JAVACMD="${TC_INSTALL_DIR}/bin/dso-java.sh"
export JAVA_OPTS="$JAVA_OPTS -Dtc.config=(Set path to the terracotta config file)" - Start Grails web server
grails -Dserver.port=(Set Port Number) run-app dev
(When executing this command, jetty is started after grails command run the terracotta client and read the configration file because the JAVACMD environment variable is set to the terracotta shell script file) - Integration terracotta with the tomcat
Please refer to the terracotta documentation for more detail.
http://www.terracotta.org/web/display/orgsite/Tomcat+Integration
Following is a sample tomcat startup script.JAVA_HOME="(top directory name installed the jdk)"
JAVA_OPTS="-server -Xms256m -Xmx512m -Xss256k"
TOMCAT_HOME="(top directory name installed the tomcat)"
PATH="$PATH:$JAVA_HOME/bin:$ANT_HOME/bin:$TOMCAT_HOME/bin"
TC_INSTALL_DIR="(directory name installed the terracotta)"
TC_CONFIG_PATH="(full path name of the terracotta configuration file.)"
. $TC_INSTALL_DIR/bin/dso-env.sh -q
export JAVA_OPTS="$TC_JAVA_OPTS $JAVA_OPTS"
sh ${TOMCAT_HOME}/bin/catalina.sh start - Integration terracotta with jetty
Please refer to the terracotta documentation.
http://www.terracotta.org/web/display/orgsite/Jetty+Integration
2008年12月17日水曜日
[Grails]Integration Terracotta(Java VM Clustering) with Grails manually
Steps to Integrate the Terracotta(Java VM Clustering) with Grails manually without using the Terracotta plugin.
2008年12月15日月曜日
[Linux]yum process hangs and stacks without erroring out
- References
Yum hangs(http://www.windley.com/archives/2007/04/yum_hangs.shtml) - Description
yum process sometimes hangs and stacks without erroring out. No error messages are outputted. I get the result of strace for the command "yum clear all" as follows.> strace -f -F yum clear all
......
stat64("/var/lib/rpm/DB_CONFIG", 0xbf93281c) = -1 ENOENT (No such file or directory)
open("/var/lib/rpm/DB_CONFIG", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
stat64("/var/lib/rpm/__db.001", {st_mode=S_IFREG|0644, st_size=24576, ...}) = 0
open("/var/lib/rpm/__db.001", O_RDWR|O_LARGEFILE) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=24576, ...}) = 0
close(3) = 0
open("/var/lib/rpm/__db.001", O_RDWR|O_LARGEFILE) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
mmap2(NULL, 24576, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0xb7a17000
close(3) = 0
stat64("/var/lib/rpm/__db.002", {st_mode=S_IFREG|0644, st_size=1318912, ...}) = 0
open("/var/lib/rpm/__db.002", O_RDWR|O_LARGEFILE) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
mmap2(NULL, 1318912, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0xb78d5000
close(3) = 0
stat64("/var/lib/rpm/__db.003", {st_mode=S_IFREG|0644, st_size=450560, ...}) = 0
open("/var/lib/rpm/__db.003", O_RDWR|O_LARGEFILE) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
mmap2(NULL, 450560, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0xb7867000
close(3) = 0
stat64("/var/lib/rpm/Packages", {st_mode=S_IFREG|0644, st_size=19869696, ...}) = 0
open("/var/lib/rpm/Packages", O_RDONLY|O_LARGEFILE) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
read(3, "\0\0\0\0\1\0\0\0\0\0\0\0a\25\6\0\10\0\0\0\0\20\0\0\0\10"..., 512) = 512
close(3) = 0
open("/var/lib/rpm/Packages", O_RDONLY|O_LARGEFILE) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=19869696, ...}) = 0
futex(0xb78c587c, FUTEX_WAIT, 1, NULL - Solution
remove the __db.* files under the /var/lib/rpm and retry running the yum command.
2008年12月12日金曜日
[Grails]Split Write Database Connection Plugin for master/slave configuration(Alpha version 0.2)
Please refer to the
http://taapps-javalibs.blogspot.com/2009/04/grailsupgraded-split-write-database.html
Grails Split Write Database Connection Plugin for master-slave configuration (Alpha version 0.2, like the magic multi connection for rails framework, multiple datasource)
After installing this plugin, we can split the read/write database connection and write any data to the other database and System will inject new methods into the Domain Classes named like saveXXXXX, lockXXXXX, deleteXXXXX, executeUpdateXXXXX method to split writing the data to the other databases.
Refer to the http://groups.google.com/group/taapps-sourcecode-libraries/web/grails-split-write-database-connection-plugin
http://taapps-javalibs.blogspot.com/2009/04/grailsupgraded-split-write-database.html
Grails Split Write Database Connection Plugin for master-slave configuration (Alpha version 0.2, like the magic multi connection for rails framework, multiple datasource)
After installing this plugin, we can split the read/write database connection and write any data to the other database and System will inject new methods into the Domain Classes named like saveXXXXX, lockXXXXX, deleteXXXXX, executeUpdateXXXXX method to split writing the data to the other databases.
Refer to the http://groups.google.com/group/taapps-sourcecode-libraries/web/grails-split-write-database-connection-plugin
2008年12月8日月曜日
[GRAILS]how to use the String type for the primary key column
How to use the String type primary key column in Domain Class on Grails environment.
- the definition of the Domain Class
class Test {
//define id column as String type
String id
.....
//define the id generator type, it should use the manual assignment
static mapping={
id generator:'assigned'
}
} - using this domain class
def index = {
//create new object defined the primary key as the String type.
def test=new Test()
def date=new Date()
//set the unique value of primary key manually.
test.setId("pk-${date.getTime()}")
test.setMsg("Message")
//save
test.save()
...
}
2008年10月6日月曜日
[grails]create plugin for grails to execute native query
I upgraded the new version file, please refer to the http://taapps-javalibs.blogspot.com/2009/04/grailsupgraded-plugin-for-grails-to.html
I create grails plugin named native-query to execute native query statement like ORACLE's query hint, mysql match-against statement on the grails framework.
I wrote a blog entry "[Groovy>Grails] Customization, how to execute Native SQL statement on Grails environment" before. but this customization is not useful. I create a new plugin having the same functionality.
I create grails plugin named native-query to execute native query statement like ORACLE's query hint, mysql match-against statement on the grails framework.
I wrote a blog entry "[Groovy>Grails] Customization, how to execute Native SQL statement on Grails environment" before. but this customization is not useful. I create a new plugin having the same functionality.
- download zip file named grails-native-query-0.1.zip via http://groups.google.com/group/taapps-sourcecode-libraries/web/grails-native-query-0.1.zip
- installing plugin into the grails application
grails install-plugin grails-native-query-0.1.zip
2008年9月11日木曜日
[WinVista]Not display and apply the Windows Vista Service Pack programs via Windows Update
This issue is not related to the java or java's libraries, this is windows vista issue.
Description
Windows Update program doesn't list the Windows Vista Service pack 1 and we can't apply the Window Vista Service Pack 1 via Windows Update program.
References
- Information about Windows Vista Service Pack
http://support.microsoft.com/kb/936330/ - Windows Vista Service Pack 1 is not available for installation from Windows Update and is not offered by Automatic Updates
http://support.microsoft.com/kb/948343
Cause
Before installing the Windows Vista Service Pack1, System needs to be applied all important programs and patches listed on Windows Update. System doesn't display and list the Vista Service Pack 1 until applying all important patches and updates.
(not require the optional programs. for example, we don't need to apply the patches for the silverlight even if the programs are listed on Windows Update.)
Maybe this problem doesn't occure when setting the automatically windows update mode.
Resolution
[WinVista]Error occured while installing windows vista service pack 1
This issue is not related to the java or java's libraries, this is windows vista issue.
Description
Error occured when installing the Windows Vista Service pack 1 on Vista Home Edition environment. I tried to install several times, but same error occured everytime.
References
- Information about Windows Vista Service Pack 1
http://support.microsoft.com/kb/936330/en - http://support.microsoft.com/kb/947366
- http://www.somelifeblog.com/2008/07/fixed-vista-sp1-error-0x800f0826.html
Error details
Error message was as follows.
An internal error occured while installing the service pack.
Error Code: 0x0800F0826 See http://go.microsoft.com/fwlink/?linkid=101139
Cause
Before installing the Windows Vista Service Pack1, System needs to be applied all important programs and patches listed on Windows Update.
(not require the optional programs. for example, we don't need to apply the patches for the silverlight even if the programs are listed on Windows Update.)
Maybe this problem doesn't occure when setting the automatically windows update mode.
Resolution
- Open the Windows Update via Start Menu->Windows Vista or Open the Start Menu and enter the "Windows Update" in the search fields at the bottom of Start Menu.
- Check the important programs and patches you haven't applied yet listed on Windows Update.
- If you have any programs you haven't applied yet, please try to apply all of the programs marked as Important.
- After applying the programs listed on Windows Update, reboot the Windows machine.
- Retry to apply the Windows Service Pack program.
(Please look at the documentation "Information about Windows Vista Service Pack 1" and check the "What to do before you install Windows Vista SP1" section.)
登録:
投稿 (Atom)