Skip to main content

Some Advanced Ant Tasks (ANT Part-5)

In our last posts we have seen 

Sleep: If you want some gap between two tasks or want some pause then  this task is used to sleep the build process for a while. We can use milliseconds,seconds and hours also in aatribute. 

<sleep milliseconds="10"/> 

 Sql: To execute some query or after finishing a task you want to update some column in any table or want to fire any type of query then this task is used to execute SQL commands using Java JDBC connectivity. 
<sql 
 driver="jdbc driver name" 
 url="jdbc url" 
 userid="ui" 
 password="pass" 
 > 
insert 
insert into aots_users values (1, "aots1"); 
</sql> 

FTP: After creating any patch or folder you want to copy it on nay FTP to allow others to access it from another location then this task is used to ftp files to a ftp server 
 <ftp server="ftp.tcs.org" 
 remotedir="incoming" 
 userid="hemant12345" 
 password="hk@123" 
 depends="yes"> 
 <fileset dir="d:mypatch/currentpatch"/> 
 </ftp>

Sound: If you are running a build or any other task and do not want to sit and watch screen but you want to raise an alarm after finishing the task then you can use this task is to create sound during the build process for specific tasks. 
 <sound> 
 <success source="alert.wav"/> 
</sound>



Attrib: This task is used to set the properties of a file 
 <attrib file="username.properties" readonly="true" hidden="true"/> 

Sync:  To synchronize two folders we can use this task. This file will overwrite the data and also it will remove the files from the todir folder. 
<sync todir="Server"> 
 <fileset dir="local"/> 
</sync> 

LoadProperties: This task is used to load the contents of the properties file as ant properties.Means you do not need to rewrite the property file for ant in separately. 
The properties should be as key=value format 

 <loadproperties srcFile="file.properties"/>



You may also like:-

Using JConsole in java And creating memory dump by it


Heap analysis by Memory Analyzer (MAT) - Eclipse java


Main causes of Out-Of-Memory Errors in java


Five main types of Memory leaks in java


How to Reduce Garbage-Collection Pause Time?


4 Mains causes of Long Garbage Collection Pause?


How Application Performance get impacted by Garbage Collection?


Java Performance Tuning options Java heap


Why Memory leak in Java ?


What is a Memory Leak in java?


What is Garbage collector in java and how it works?


What is Garbage Collector Compaction in Java?


What are Java heap Young, Old and Permanent Generations?


What is difference between Web Server and Application Server ?


What is the maximum ram for 32 bits and 64 bits computer?


Some Amazing fact about memory (petabyte,exabyte,zettabyte) And How much data exists on the Web?

Popular posts from this blog

What are Java heap Young, Old and Permanent Generations?

The Java heap is dived into two parts i.e. Young generation and old generation. Young generationYoung generation  memory is 40% of Maximum Java Heap. It consists of two parts, Eden space and Survivor Space. Eden SpaceInitially objects are created in this  Part of Java Heap , here most objects die and quickly are cleaned up by the minor Garbage Collectors (It only runs in young generation and its frequency is high in compared to major garbage collector). Usually any new objects created inside a Java Method go into Eden space and the objects space is reclaimed once the method execution completes. Whereas the Instance Variables of a Class usually lives longer until the Object based on that class gets destroyed. When Eden fills up it causes a minor collection, in which some surviving objects are moved to Survivor Space or an older generation. Survivor Space  The pool containing objects that have survived the garbage collection of the Eden space The parameter Survivor Ratio can be used to tune…

Compression of HttpServletRequest and HttpServletResponse by gzip encoding

Description 
This filter is on HTTP headers in a HttpServletRequest, compress data written to the HttpServletResponse, or decompress data read from the request. When supported by the client browser, this can potentially greatly reduce the number of bytes written across the network from and to the client. As a Filter, this class can also be easily added to any J2EE 1.3+ web application.





Installation

1).Add the pjl-comp-filter-XX.jar file containing CompressingFilter to your web application's WEB-INF/lib directory.

2).Add the following entries to your web.xml deployment descriptor:

 <filter>
  <filter-name>CompressingFilter</filter-name>
  <filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class>
 </filter>

 <filter-mapping>
  <filter-name>CompressingFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

The below data is of my application where i tested this compression technique…

4 mains causes of Long Garbage Collection Pause?

So a long GC Pause can have a direct impact on response time and throughput. But there are some causes for long GC pause which you can check and avoid to increase performance. They are as follows:-


1)Insufficient heap size:- If heap size is small then the size required then the allocation requests for new objects  fail and the JVM needs to invoke garbage collections in an attempt to reclaim space for the allocations. So these frequent Full GCs cause long pauses in the application run. To avoid long GC pause by this identify the average footprint of the application and then specify the heap size accordingly.
2)Fragmentation in the heap:-GCs can occur more frequently due to fragmentation in the Java Heap  and also sometimes causing long pauses in the GCs. This is more probable in the case of Concurrent Mark Sweep collector, also known as CMS, where the tenured generation space is not compacted with the concurrent collections. For more please go through the previous post about heap  compact…