How ZooKeeper ACL works

In this post I will describe the basic principles of how ACL works in ZooKeeper. ACL is not set recursively and is not inherited by the child nodes. If we have a read-only ACL for /path1/path2 or /path1/path2/path3, then deleting /path1 will fail, regardless of AСL of /path1. Several ACL records can be set on […]

READ MORE

Perform some action when spec fails in Spock Framework

Let’s imagine that we need to perform a certain sequence of actions when a spec fails. If you just need to close some resources when spec fails – don’t reinvent the wheel and use an easy and correct method – @AutoCleanup annotation. I wrote about it in detail earlier: https://mchesnavsky.tech/closing-resources-in-spock-framework. Keep in mind that in […]

READ MORE

Closing resources in Spock Framework

If we have any resource and we need to close it when current spec fails or done (for example, ZooKeeper client), the easiest way is to use the @AutoCleanup annotation with the resource: By default, it calls the close() method, but you can put your own: And optionally use quiet mode, when Spock Framework are going […]

READ MORE

Apache Atlas – Building & Installing

Let’s say we want to got working Apache Atlas instance with embedded Hbase & Solr on our machine. Notice, that you need to install JDK 8 before start. Go to the Apache Atlas GitHub page, and download the zip file with the source code of the latest stable release from here: https://github.com/apache/atlas/tags Important notice: DO […]

READ MORE

How to add files to META-INF with Maven

Suppose you need to add some_dir/your_file.txt to META-INF using Maven, so that the final path looks like this: To do this, you need to create a META-INF/some_dir folders in the src/main/resources directory, and put there your_file.txt file: Once compiled, Maven will move META-INF/some_dir/your_file.txt from resources to the right place without deleting the existing files in […]

READ MORE

Get Maven artifact version at runtime

Let’s imagine that we need to get the value of a certain Maven property in Java code. First, let’s create a text file with any name, for example version.txt in the src/main/resources folder: Now let’s add the following block to pom.xml: Now, when building, Maven will replace the construction ${project.version} in the file with the […]

READ MORE

How to immediately terminate the Spring Boot Yarn container with an error

Imagine an error or exception occurs while running the Spring Boot Yarn container, and we need to kill container from itself and return an error code. You can use @OnContainerStart annotation as mentioned in this article: https://mchesnavsky.tech/how-to-set-up-exit-code-on-spring-boot-yarn-container. But if we need to stop the container immediately, we just need to call: – where parameter is […]

READ MORE

Force kill the process by name Linux

Suppose that you need to force kill a process by name or parameters in Linux. You can do it using this bash command: Let’s analyze this set of the commands: Execute ps ax. This command will list the processes on the system. Next, we find in this list those processes that have the text in […]

READ MORE