Monday, April 20, 2020

Git - more on Git Tags -




The following steps outlines the Git Tag delete process both locally and remotely.
  1.  Fetch all the tags from
    git fetch --tags
  2. Delete the tag locally
    git tag -d yourTagToDelete  (eg: git tag -d v1.15.0)
  3. Delete the tag in Remote
    git push origin :yourTagToDelete (eg git push origin :v1.15.0)
  4. Create a new  tag locally
    git tag yourNewTag  (eg: git tag v1.15.0)
  5. Push tag to Remote
    git push origin yourTagToDelete (eg git push origin v1.15.0)

Read More...

Saturday, April 18, 2020

Restarting Spring Boot Application !

Restarting Spring Boot Application  !

You have several options to restart Spring boot Application . You can restart either of the following three options. Based on your requirement you can choose one of the following.

  1. Using spring-boot-devtools
  2.            Add your Gradle dependency
        dependencies{ 
                    compileOnly("org.springframework.boot:spring-boot-devtools")
      }
        After that Add, you can simply add an end poing on your controller class and have the following:
              org.springframework.boot.devtools.restart.Restarter.getInstance().restart();   

    The drawback of using tools is you cannot make a good used of @Cacheable . it might cause ClassCastException while reading from the cache.

  3. Using RestartEndPoint from 
  4.    Add your Gradle dependency
      dependencies{ 
         compile "org.springframework.boot:spring-boot-starter-actuator"
      }
        After that Add, you can simply add an end on your controller class and have the following:
         @Autowired
         RestartEndpoint restartEndpoint;
         
        And call the following methond from your controller :
        restartEndpoint.restart() 
         
    You might see NullPointer Exception while trying to bring the application up specially when you have UnderTow as your servlet container 
     3.   And the third one is reading the current context and restarting it. You can simply add the following method on the Main Class and invoke from your controller
       public static void restart() {
          ApplicationArguments args = appContext.getBean(ApplicationArguments.class);
          Thread thread = new Thread(() -> {
          appContext.close();
          SpringApplication springApplication = new SpringApplication(MyBootApplication.class);
          springApplication.addListeners(new ApplicationPidFileWriter());
          appContext =springApplication.run(args.getSourceArgs());
        });
       thread.setDaemon(false);
       thread.start();
      }

Read More...

Saturday, March 21, 2020

Thread Dumping in Unix - flyway recorder !

 jcmd 8308 JFR.start duration=100s filename=tempo.jfr

Read More...

Thursday, March 5, 2020

Monogo Pipeline scripts !

1. Filter by an assistance of an array element in a document:
  $and:[{assessmentPeriods:{$ne:null, $exists:true, $ne: []}}  ]

2. 


Read More...

Friday, April 5, 2019

Java 11 and Groovy Compatibility and JAXBContext !


If you see the following error during compile : 


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestGroovy'.
> org/codehaus/groovy/ast/MethodCallTransformation


Add the folling line to your gradle file :

ext['groovy.version'] = '2.5.6'  //i.e your grovy version.


Another issues with java 11

 Unable to load class groovy.xml.jaxb.Jaxb GroovyMethods due to missing dependency javax/xml/bind/JAXBContext 

You can fix this by adding the following dependency on the latest groovy version


Read More...

Wednesday, February 6, 2019

Useful Unix Commands

1. Count number of lines on all the files in the current folder
wc -l *

2. Count the number of files on the current directory :
ls | wc -l
3. Print all the line containing word/s in a file
grep -iw "search words" arc.log
4. Thread dumping for a process
 jcmd 8308 JFR.start duration=100s filename=tempo.jfr

Read More...

Wednesday, December 19, 2018

Simple hack to Update System Properties and Environment variables on Window !

If you don't have a permission to edit the System variable on your local window machine, the following hack might work

Click Window and  type "SystemPropertiesAdvanced"  on Search programs and file search text option. Then, once you see the 
SystemPropertiesAdvanced shortcut, right click it and open it as an administrator.  You might be able to edit it now.




Read More...

Pages

 ©mytechtoday.com 2006-2010

 ©Mytechtoday

TOP